From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,edb6dd3a3f93fcc0 X-Google-Attributes: gid103376,public From: "Howard W. LUDWIG" Subject: Re: trunc Date: 1999/03/22 Message-ID: <36F6745D.BBE97778@lmco.com>#1/1 X-Deja-AN: 457612303 Content-Transfer-Encoding: 7bit References: <7crcfm$tp0$1@nnrp1.dejanews.com> <7ctjsj$b20@top.mitre.org> To: Michael F Brenner Content-Type: text/plain; charset=us-ascii Organization: Lockheed Martin -- Information Systems Center Mime-Version: 1.0 Reply-To: howard.w.ludwig@lmco.com Newsgroups: comp.lang.ada Date: 1999-03-22T00:00:00+00:00 List-Id: 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?