comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Ada decimal types
Date: Mon, 8 May 2006 16:19:43 -0500
Date: 2006-05-08T16:19:43-05:00	[thread overview]
Message-ID: <8KadnYXCB-5FKMLZnZ2dneKdnZydnZ2d@megapath.net> (raw)
In-Reply-To: yj47g.23728$ZQ3.20636@twister.nyroc.rr.com


"REH" <me@you.com> wrote in message
news:yj47g.23728$ZQ3.20636@twister.nyroc.rr.com...
...
Also, duration is a binary fixed point.
> A don't want to use those because precision may be lost.  Whether or not
the
> loss will be an issue, I do not know but I would rather not risk it.  Of
> course I just may be worrying over nothing.

You're still very confused. Semantically, there is no difference between

    type Mission_Time_Type is delta 1.0e-6 range 0.0 .. (2.0**32) - 1.0;
    for Mission_Time_Type'Small use 1.0e-6;

and

    type Mission_Time_Type is delta 1.0e-6 digits 14;

other than the bounds of the base type and the rounding of the "*" and "/"
operations. The *precision* is identical, because that depends *only* on the
value of 'small [for all fixed point types], and that is the same for both
of these types. [There might be representation differences, but those can't
change the semantics of the types.]

Of course, specifying the small is necessary to get the appropriate
precision for the ordinary fixed point type (as the default is not what you
want). But that is always a good idea with fixed point; it's too important
of a choice to leave it to the compiler, and it is best to document it
explicitly in the source code.

                                Randy.






  reply	other threads:[~2006-05-08 21:19 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-04 15:23 Ada decimal types REH
2006-05-04 18:17 ` Jeffrey R. Carter
2006-05-04 22:20   ` REH
2006-05-05  9:14 ` Stephen Leake
2006-05-05 11:33   ` REH
2006-05-05 16:49     ` tmoran
2006-05-05 18:08       ` REH
2006-05-05 18:49         ` tmoran
2006-05-05 18:59           ` REH
2006-05-06  8:59         ` Keith Thompson
2006-05-06 14:01           ` REH
2006-05-06 15:48             ` Simon Wright
2006-05-06 16:39               ` REH
2006-05-08 21:19                 ` Randy Brukardt [this message]
2006-05-09 23:21                   ` REH
2006-05-10  1:08                     ` Keith Thompson
2006-05-10  5:37                     ` Simon Wright
2006-05-10 12:22                       ` REH
2006-05-10 20:47                         ` Randy Brukardt
2006-05-10 21:26                           ` REH
2006-05-10 20:52                       ` Randy Brukardt
2006-05-11  5:51                         ` Simon Wright
2006-05-11 22:33                           ` Randy Brukardt
2006-05-05 20:32     ` Randy Brukardt
replies disabled

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