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,MAILING_LIST_MULTI, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a11a564bb5e4dd56 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-09-28 13:19:03 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.icl.net!newsfeed.fjserv.net!proxad.net!freenix!enst.fr!not-for-mail From: "David C. Hoos, Sr." Newsgroups: comp.lang.ada Subject: Re: Trouble with s'fraction attribute. Date: Sat, 28 Sep 2002 15:18:32 -0500 Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: References: Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 7bit X-Trace: avanie.enst.fr 1033244342 42325 137.194.161.2 (28 Sep 2002 20:19:02 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Sat, 28 Sep 2002 20:19:02 +0000 (UTC) Return-Path: X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2711.0600 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.13 Precedence: bulk List-Unsubscribe: , List-Id: comp.lang.ada mail<->news gateway List-Post: List-Help: List-Subscribe: , Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Original-Cc: john.thile@murraystate.edu Xref: archiver1.google.com comp.lang.ada:29407 Date: 2002-09-28T15:18:32-05:00 You need to re-read the definition of the 'Fraction attribute. What you probably want is the 'Remainder attribute, of which an example is presented here: with ada.text_io, ada.float_text_io; use ada.text_io, ada.float_text_io; procedure remainder is number, int, fl : float; begin number := 3.141592654; int := float'truncation(number); fl := float'remainder(Number,int); put(int); new_line; put(fl); end remainder; ----- Original Message ----- From: "gilrain" Newsgroups: comp.lang.ada To: Sent: September 28, 2002 3:01 PM Subject: Trouble with s'fraction attribute. > Hi all, > > I'm writing a program in which I need to seperate the integer and fractional > parts of a float. After reading some documentation, it seemed like this > should do the trick: > > with ada.text_io, ada.float_text_io; > use ada.text_io, ada.float_text_io; > procedure test is > number, int, fl : float; > begin > number := 2.9; > > int := float'truncation(number); > fl := float'fraction(number); > > put(int,0,0,0); new_line; > put(fl,0,0,0); > end test; > > When this is run, int truncates as expected outputs as "2.0". Good. However, > fl outputs as "0.7", which isn't at all what I expected (0.9) or wanted. > What's going on here? I expect I've somehow misunderstood what the > s'fraction attribute does; is there a standard function for what I'm trying > to accomplish? > > Thanks, > > John Thile > > > > _______________________________________________ > comp.lang.ada mailing list > comp.lang.ada@ada.eu.org > http://ada.eu.org/mailman/listinfo/comp.lang.ada > >