comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@acm.org
Subject: Re: Positive Floating Range?
Date: Sat, 21 Apr 2001 07:25:18 GMT
Date: 2001-04-21T07:25:18+00:00	[thread overview]
Message-ID: <yBaE6.12619$Jh5.13013128@news1.rdc1.sfba.home.com> (raw)
In-Reply-To: 817E6.2056$DW1.94361@iad-read.news.verio.net

>Also, while I can get a Float, the compiler claims that there's no
>such thing as a "Double".  At first I figured maybe Ada used the
>double all the time (like Perl does), but Float'Machine_Radix is 2,
  Normally in Ada you are supposed to specify exactly what you want
type Rough is digits 3;
type Very_Precise is digits 11;

>But it's not clear what happens if I specify something which is too
>precise (or too many digits) for the machine's natural double-word size.
  LRM 3.5.7(7) says "A floating_point definition is illegal if the
implementation does not support a floating point type that satisfies
the requested decimal precision and range."

  You can be sloppy and use Float because LRM 3.5.7(12) says "There
is a predefined, unconstrained, floating point subtype named Float,
declared in the visible part of the package Standard."  But it's
*possible* Float is not as big as you want, since LRM3.5.7(14) says
merely "In an implementation that supports floating point types with
6 or more digits of precision, the requested decimal precision for
Float shall be at least 6."  But if you did happen to be on a machine
with, say, 4 digit Floats, then
  X : Float;
would be only 4 digits, and perhaps generate incorrect answers, while
  type Minimal_Float is digits 5;
  X : Minimal_Float;
would force the compiler to generate a "No can do" message at the
Minimal_Float declaration, thus warning you of the potential problem.

  You may be able to also use Long_Float since LRM 3.5.7(15) says
"If Long_Float is predefined for an implementation, then its requested
decimal precision shall be at least 11."

>        type foo is delta 0.000001 digits 20;
  That declares a decimal fixed point type, not a binary floating
point one.



  reply	other threads:[~2001-04-21  7:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-21  3:21 Positive Floating Range? Dr Nancy's Sweetie
2001-04-21  7:25 ` tmoran [this message]
2001-04-21 14:57 ` Samuel T. Harris
2001-04-22  1:14 ` Jeffrey Carter
2001-04-23 14:13 ` Marin David Condic
2001-05-01 20:40 ` Georg Bauhaus
replies disabled

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