comp.lang.ada
 help / color / mirror / Atom feed
From: achrist@easystreet.com
Subject: Re: float problem
Date: Mon, 08 Jul 2002 12:28:49 -0700
Date: 2002-07-08T12:28:49-07:00	[thread overview]
Message-ID: <3D29E7F1.183E543C@easystreet.com> (raw)
In-Reply-To: pan.2002.07.07.17.55.32.704378.1959@gmx.net

Jan Prazak wrote:
> 
> On Sun, 07 Jul 2002 13:08:01 -0100, Frank J. Lhota wrote:
> 
> > The error is small enough to
> > not affect the printed output, where things are rounded to six
> > significant digits, ...
> 
> Thanks, I didn't know that procedure "put" rounds given number. I have
> just started to learn Ada, but I was using Pascal (and a bit Delphi)
> before, where there is no rounding in procedure "write".
> BTW: is it possible to disable the rounding in "put"? Maybe with some
> global boolean variable or someting (maybe a pragma).

If there was no rounding, then displaying a number with absolute value
less than one would require 1 decimal digit to show each bit to the
right of the decimal (or binary) point.  Short floating point values
(on typical hardware) in Ada or Pascal would require about 24 digits.
Double precision values would require about 53 digits,  and long double
precision would require about 64 digits. 

The 'unrounded' values that you get from Pascal, etc, show the value
to full precision, ie the rightmost digit shown is the one about where
the effects of rounding and truncation error show up, depending on how
much rounding and truncation has happened.  Any digits beyond those
shown are probably of questionable value at best, but that doesn't mean
that there is no rounding to produce the output you see.


Al



  parent reply	other threads:[~2002-07-08 19:28 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-07 15:06 gnat: float problem Jan Prazak
2002-07-07 14:08 ` Frank J. Lhota
2002-07-08 20:20   ` Jan Prazak
2002-07-08 18:10     ` David C. Hoos
2002-07-09  1:05       ` Robert A Duff
2002-07-09  2:14         ` David C. Hoos, Sr.
2002-07-08 18:19     ` Frank J. Lhota
2002-07-08 19:12     ` tmoran
2002-07-08 19:28     ` achrist [this message]
2002-07-08 23:00     ` Jan Prazak
2002-07-08 23:00     ` Jan Prazak
2002-07-08 20:34       ` David C. Hoos
2002-07-09 13:36       ` Ted Dennison
2002-07-09 19:03         ` Jeffrey Carter
2002-07-09 20:07         ` Robert Dewar
2002-07-07 21:04 ` gnat: " achrist
replies disabled

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