comp.lang.ada
 help / color / mirror / Atom feed
From: "Björn Lundin" <b.f.lundin@gmail.com>
Subject: Re: Fixed vs float and precision and conversions
Date: Wed, 8 Jul 2020 10:17:08 +0200	[thread overview]
Message-ID: <re3ve4$kca$2@dont-email.me> (raw)
In-Reply-To: <hmk7rlF4nfjU1@mid.individual.net>

Den 2020-07-07 kl. 23:30, skrev Niklas Holsti:

> 
> According to RM 4.6(31), conversion to a decimal fixed-point type does 
> not round, but truncates toward zero if the operand is not a multiple of 
> the "small" of the target type, which is usually the case here if Floats 
> are base-two.
> 
> You should perhaps change the conversion (Target := Fixed_Type(Tmp)) to 
> round, by doing Target := Fixed_Point'Round (Tmp).
> 
> Note, I haven't tried it.

Ok - nice idea. I'll try it, thanks.



-- 
Björn

  reply	other threads:[~2020-07-08  8:17 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-07 21:10 Fixed vs float and precision and conversions Björn Lundin
2020-07-07 21:30 ` Niklas Holsti
2020-07-08  8:17   ` Björn Lundin [this message]
2020-07-07 21:58 ` Shark8
2020-07-08  8:15   ` Björn Lundin
2020-07-08 16:16     ` Shark8
2020-07-08 18:08       ` Björn Lundin
2020-07-08 18:10         ` Björn Lundin
2020-07-08 18:21           ` Niklas Holsti
2020-07-08 19:39             ` Björn Lundin
2020-07-08 20:34               ` Niklas Holsti
2020-07-08 21:24                 ` Björn Lundin
2020-07-09  7:11                   ` Niklas Holsti
2020-07-08 18:36           ` Dmitry A. Kazakov
2020-07-08 19:41             ` Björn Lundin
2020-07-09  6:20               ` Dmitry A. Kazakov
2020-07-09  7:23                 ` Björn Lundin
2020-07-09  7:49                   ` Dmitry A. Kazakov
2020-07-08 21:16         ` Shark8
2020-07-08 21:47           ` Björn Lundin
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox