comp.lang.ada
 help / color / mirror / Atom feed
From: "Howard W. LUDWIG" <howard.w.ludwig@lmco.com>
To: Michael F Brenner <mfb@mbunix.mitre.org>
Subject: Re: trunc
Date: 1999/03/22
Date: 1999-03-22T00:00:00+00:00	[thread overview]
Message-ID: <36F6745D.BBE97778@lmco.com> (raw)
In-Reply-To: 7ctjsj$b20@top.mitre.org

Besides the issue, as Markus K. pointed out, that these attributes
are functions, the description below of the 'Fraction attribute is
likely misleading.

The inference I draw from the description below is that if I have
a floating-point number X of type T, then I can decompose X into
an integer part and a fractional part, whose sum is X, using these
two attributes.  However, using the URL given below, one can see
that 'Fraction is the counterpart of 'Exponent to decompose a
floating-point number into a fractional mantissa and an exponent, such that
     X := T'Fraction(X) * T'Machine_Radix**T'Exponent(X).

HWL

Michael F Brenner wrote:

> The most efficient way is to go to URL http://www.adahome.com/rm95/
> which is the Ada 95 Reference Manual which points you to the URL:
>
>     http://www.adahome.com/rm95/rm9x-A-05-03.html
>
> which defines the floor attribute which works like this:
>
>    y:=x'floor;      -- Postcondition: Y is now the whole-number of X
>    f:=x'fraction;   -- Postcondition: F is now the fractional value of X
>
> > what's the most efficient way within Ada
> > to obtain the whole-number portion Y of
> > a floating-point number X?







      parent reply	other threads:[~1999-03-22  0:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-03-18  0:00 trunc phadreus
1999-03-18  0:00 ` trunc Matthew Heaney
1999-03-18  0:00   ` trunc Nick Roberts
1999-03-18  0:00   ` trunc Tucker Taft
1999-03-19  0:00     ` trunc Michael Stark
1999-03-19  0:00 ` trunc Michael F Brenner
1999-03-19  0:00   ` trunc Markus Kuhn
1999-03-22  0:00   ` Howard W. LUDWIG [this message]
replies disabled

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