comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@acm.org
Subject: Re: float problem
Date: Mon, 08 Jul 2002 19:12:48 GMT
Date: 2002-07-08T19:12:48+00:00	[thread overview]
Message-ID: <QulW8.2017$%a2.223158437@newssvr14.news.prodigy.com> (raw)
In-Reply-To: pan.2002.07.07.17.55.32.704378.1959@gmx.net

> ... but I was using Pascal (and a bit Delphi)
> before, where there is no rounding in procedure "write".
  So it must print n decimal digits to correctly represent 1/2**n,
e.g. a 4 byte IEEE float must print 23 digits.
> BTW: is it possible to disable the rounding in "put"? Maybe with some
> global boolean variable or someting (maybe a pragma).
  Look at the "Aft" parameter in Float_IO.Put You can specify how many
digits you want printed to the right (or left) of the decimal point.  You
didn't say, so the compiler used Default_Aft.  Your post showed 5 digits
to the right, so Default_Aft must be 5, so Float'digits is 6 in your
compiler.  Thus all your calculations, and printing, were done to 6 digit
accuracy.  If you want something different from the defaults you will have
to say so in your program.  Defaults are a convencience, but they can also
be a trap for the unwary.



  parent reply	other threads:[~2002-07-08 19:12 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 [this message]
2002-07-08 19:28     ` achrist
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