From: tmoran@acm.org
Subject: Re: altering number of significant figures
Date: Tue, 28 Sep 2004 06:41:39 GMT
Date: 2004-09-28T06:41:39+00:00 [thread overview]
Message-ID: <DI76d.128316$D%.119101@attbi_s51> (raw)
In-Reply-To: 4158fd82@dnews.tpgi.com.au
> myfloat : float := 1234.5678;
> screen_display("value = " & float'image(myfloat));
>The above will print "value = 1234.5678". However I want "value = 1234.56".
I presume you actually want it rounded, not truncated.
You can use Ada.Text_IO.Float_IO to make a string, with full control
over total length, digits after the point, and E exponent notation.
Another option is
type Two_Aft_Digits is delta 0.01 range ...
screen_display("value = " & Two_Aft_Digits'image(Two_Aft_Digits(myfloat)));
next prev parent reply other threads:[~2004-09-28 6:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-28 5:59 altering number of significant figures David Peterson
2004-09-28 6:41 ` tmoran [this message]
2004-09-28 6:51 ` Martin Krischik
2004-09-28 17:58 ` Jeffrey Carter
-- strict thread matches above, loose matches on Subject: below --
2004-09-28 6:52 Christoph Karl Walter Grein
2004-09-28 10:26 ` David Peterson
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox