comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.acm.org>
Subject: Re: Float conversion
Date: Thu, 29 Jul 2010 12:08:59 -0700
Date: 2010-07-29T12:08:59-07:00	[thread overview]
Message-ID: <i2sk70$ubo$1@tornado.tornevall.net> (raw)
In-Reply-To: <cb7a898b-fe3b-424e-adfa-9dcc22ea570c@l20g2000yqm.googlegroups.com>

On 07/29/2010 11:21 AM, Henrique wrote:
>
> As I declared the type with 6 digits, I expected that it would make
> the comparison only for these digits (this would gave var4 = var1).

"digits N" means the compiler will use at least Ceiling (N * log2 (10) ) bits 
for the mantissa, 'Image will produce a string with N digits, and an 
instantiation of Ada.Text_IO.Float_IO will output N digits by default. There was 
an effect on the minimum size of the exponent in Ada 83, but I don't think that 
applies any more. (There are probably other cases as well where the "digits" 
value has an effect that I can't think of at the moment.) But all operations, 
including comparisons, take place in the underlying implementation or with 
greater precision.

Most x86-type processors have HW floating-point types that correspond to digits 
7, 15, and 18 (IIRC), so on such a machine you should expect your compiler to 
choose one of those. All computations are done using the digits-18 
representation, so there doesn't seem to be much reason to choose another 
representation.

-- 
Jeff Carter
"Well, a gala day is enough for me. I don't think
I can handle any more."
Duck Soup
93



  reply	other threads:[~2010-07-29 19:08 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-29 12:23 Float conversion Henrique
2010-07-29 12:44 ` Jacob Sparre Andersen
2010-07-29 12:46 ` Dmitry A. Kazakov
2010-07-29 15:08   ` Georg Bauhaus
2010-07-29 15:10     ` Georg Bauhaus
2010-07-29 15:35     ` Dmitry A. Kazakov
2010-07-29 18:21       ` Henrique
2010-07-29 19:08         ` Jeffrey R. Carter [this message]
2010-07-29 19:15         ` Dmitry A. Kazakov
2010-07-30  1:30           ` Phil Clayton
2010-07-30  8:43             ` Dmitry A. Kazakov
2010-07-30 13:14               ` Phil Clayton
2010-07-30 14:34                 ` Dmitry A. Kazakov
2010-07-31 15:12                 ` Stephen Leake
2010-08-03  1:07                   ` Phil Clayton
2010-08-03  3:31                     ` Shark8
2010-08-03 10:38                     ` Georg Bauhaus
2010-08-04  7:27                       ` Stephen Leake
2010-08-04 16:15                         ` Georg Bauhaus
2010-08-04 16:32                       ` Phil Clayton
2010-08-04  7:26                     ` Stephen Leake
2010-08-04 12:52                       ` Robert A Duff
2010-08-04 14:32                         ` Dmitry A. Kazakov
2010-08-04 19:36                           ` Simon Wright
2010-08-04 19:46                             ` Dmitry A. Kazakov
2010-08-04 20:29                             ` Georg Bauhaus
2010-08-05 12:05                         ` Stephen Leake
2010-08-07  5:54                           ` Shark8
2010-08-07  8:56                             ` Georg Bauhaus
2010-08-07 13:49                               ` Shark8
2010-08-05 10:20                       ` Phil Clayton
2010-07-30 13:16           ` Henrique
2010-07-29 15:37   ` Warren
2010-07-29 14:56 ` Georg Bauhaus
2010-07-29 17:56   ` Jeffrey R. Carter
replies disabled

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