comp.lang.ada
 help / color / mirror / Atom feed
From: Ada novice <ycalleecharan@gmx.com>
Subject: Re: understanding floating point types
Date: Sun, 22 Aug 2010 10:15:24 -0700 (PDT)
Date: 2010-08-22T10:15:24-07:00	[thread overview]
Message-ID: <37d8fbc1-fdaf-4ca9-9393-6163f2e3fa2e@s9g2000yqd.googlegroups.com> (raw)
In-Reply-To: ghi6wajpwx2t.1u5g5erb7i1i6$.dlg@40tude.net

On Aug 22, 3:57 pm, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
wrote:
>
>    My_Float'Machine_Mantissa = 53 (64-bit IEEE 754 is used to model it)
>    My_Float'Mantissa = 25
>

Yes. This is good. For Long_Float, Long_Float'Mantissa is 51.


>
> I would expect that all computations performed in machine numbers, not
> because it is mandated, I believe it is not, but because it is simpler to
> implement. At least with GNAT it is so. Try this:
>
>    type My_Float is digits 2;
>    X : My_Float := 1.0 / 3.0;
>    ...
>    Put_Line (Float'Image (Float (X)));
>
> The output will be: 3.33333E-01
>
> If you can pick any number from the interval [0.33, 0.34[ to represent 1/3
> in with 2 decimal digits. Why not 0.333333?
>

I didn't quite get this part. In my previous example with say a = 2.33
and b = 3.45. Does Multiplication of a with b mean converting each of
a and b in model number first and then do the multiplication and
afterwards approximating the result to the nearest model number? Or
the multiplication will just be performed with the two numbers as 2.33
X 3.45 = 8.0385 and then approximating this result to the nearest
model number?

Thanks.

YC



  reply	other threads:[~2010-08-22 17:15 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-22  9:11 understanding floating point types Ada novice
2010-08-22  9:51 ` Dmitry A. Kazakov
2010-08-22 10:37   ` Ada novice
2010-08-22 10:39     ` Ada novice
2010-08-22 13:57     ` Dmitry A. Kazakov
2010-08-22 17:15       ` Ada novice [this message]
2010-08-22 18:16         ` Dmitry A. Kazakov
2010-08-22 19:05           ` Ada novice
2010-08-22 19:34             ` Dmitry A. Kazakov
2010-08-23  6:29               ` Ada novice
2010-08-23  6:40                 ` J-P. Rosen
2010-08-23  7:13                 ` Dmitry A. Kazakov
2010-08-23  7:15             ` Martin
2010-08-23 11:42               ` Ada novice
2010-08-24 12:14                 ` Ada novice
2010-08-24 14:05                   ` Jacob Sparre Andersen
2010-08-24 14:36                     ` Ada novice
2010-08-22 17:22       ` Yannick Duchêne (Hibou57)
2010-08-22 18:49         ` Ada novice
replies disabled

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