comp.lang.ada
 help / color / mirror / Atom feed
From: "Robert I. Eachus" <rieachus@comcast.net>
Subject: Re: Why no 'Floor for fixed point types
Date: Thu, 23 Oct 2003 22:06:28 GMT
Date: 2003-10-23T22:06:28+00:00	[thread overview]
Message-ID: <3F98508F.2030300@comcast.net> (raw)
In-Reply-To: mailman.194.1066939697.25614.comp.lang.ada@ada-france.org

Duncan Sands wrote:
> I think the subject says it all.  Just curious.

For floating-point types, integer values are either model numbers or in 
a range limited by two integer model numbers.  (Or are IEEE infinities 
or NANs.)

But for fixed-point types, there may be few integer values that can be 
represented.  A typical example might be:

type Radians is delta Pi/1000 range -Pi..Pi;
for Radians'small use Pi/1000;

where the only integer value of the type is zero.

For type Radians what should Radians'Floor return? It doesn't make much 
sense for it to return a value that is approximately an integer, 
especially since Radians'Floor(Radians'Floor(X)) = Randians'Floor(X) 
could return false.  It might be nice to have a type conversion to 
Integer that truncated instead of rounding, but that is a different 
question.
-- 
                                            Robert I. Eachus

"Quality is the Buddha. Quality is scientific reality. Quality is the 
goal of Art. It remains to work these concepts into a practical, 
down-to-earth context, and for this there is nothing more practical or 
down-to-earth than what I have been talking about all along...the repair 
of an old motorcycle."  -- from Zen and the Art of Motorcycle 
Maintenance by Robert Pirsig




  reply	other threads:[~2003-10-23 22:06 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-23 20:09 Why no 'Floor for fixed point types Duncan Sands
2003-10-23 22:06 ` Robert I. Eachus [this message]
2003-10-24 16:00   ` Stephen Leake
2003-10-24 18:13     ` Duncan Sands
2003-10-23 23:10 ` Martin Dowie
2003-10-24 21:46 ` Nick Roberts
2003-10-25  4:29   ` Robert I. Eachus
2003-10-25 20:42     ` Nick Roberts
2003-10-25 22:40       ` Robert I. Eachus
2003-10-27 18:59         ` Randy Brukardt
2003-10-28  1:19           ` Robert I. Eachus
2003-10-28 18:23             ` Nick Roberts
2003-10-28 18:34               ` Stephane Richard
2003-10-29 19:26               ` Randy Brukardt
2003-10-30  4:55                 ` Robert I. Eachus
2003-10-28 18:10         ` Nick Roberts
2003-10-27 18:49       ` Randy Brukardt
2003-10-28 18:32         ` Nick Roberts
2003-10-29 19:29           ` Randy Brukardt
2003-10-30 23:41             ` Nick Roberts
2003-10-31 22:25               ` Randy Brukardt
2003-11-06  2:41                 ` Nick Roberts
replies disabled

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