From: "gilrain" <john.thile@murraystate.edu>
Subject: Trouble with s'fraction attribute.
Date: Sat, 28 Sep 2002 15:01:24 -0500
Date: 2002-09-28T15:01:24-05:00 [thread overview]
Message-ID: <XEnl9.3281$IO5.1464813@e3500-atl1.usenetserver.com> (raw)
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
next reply other threads:[~2002-09-28 20:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-28 20:01 gilrain [this message]
2002-09-28 20:18 ` Trouble with s'fraction attribute David C. Hoos, Sr.
2002-09-28 21:32 ` gilrain
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox