comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Ada decimal types
Date: Wed, 10 May 2006 15:47:32 -0500
Date: 2006-05-10T15:47:32-05:00	[thread overview]
Message-ID: <DNidnf2L39vQzP_ZRVn-rg@megapath.net> (raw)
In-Reply-To: 1147263720.249883.220580@j73g2000cwa.googlegroups.com

"REH" <spamjunk@stny.rr.com> wrote in message
news:1147263720.249883.220580@j73g2000cwa.googlegroups.com...
...
> OK, my assumption was that when they added decimal fixed points to the
> language, you declared them via "digits x" otherwise you would get a
> binary fixed point.  Is that not true?

There is no such thing as "binary fixed point"! There is "ordinary fixed
point" and "decimal fixed point". For all fixed point types, the "small" is
the smallest value that can be exactly represented. Other values are
multiples of the small. (The only effect of the delta is to provide guidance
for the *default* selection of the small value; the only thing that matters
is the small value). For "ordinary fixed point", the small value can be
anything. The *default* is a power of two, but it can be specified as any
value (including powers of ten). For "decimal fixed point", the *default*
small value is a power of ten.

The representation of the multiples of small can be anything that the
compiler wants to use (and this may, but doesn't have to vary between
ordinary and decimal fixed point types). Typically, the representation is
some binary integer representation.

It is possible for a compiler to reject specifying a small of 1.0e-6. That
would be a pretty lame Ada 95 compiler, IMHO, given that it has to be
supported in decimal types. Ada 83 compilers used to reject these because
there were impossible precision requirements for mixed multiplies (these
were changed in Ada 95), so there may be some Ada myths about avoiding the
specification of small values.

I think that *all* ordinary fixed point types should have 'Small specified,
because then there is no surprise or guesswork as to what precision is being
used.

I was going to suggest that you read some online resources, but I wasn't
able to find any that explain this correctly (other than the RM, and I
wouldn't suggest starting there!). Specifically, the wikibook entry is
over-simplified to the point of being wrong. I hope someone has the time to
correct it on the lines I give above.

                                      Randy.





  reply	other threads:[~2006-05-10 20:47 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
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 [this message]
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