* Newbie Question: Floating Point Decimal Rounding
@ 2003-01-29 17:58 Sam T
2003-01-29 20:09 ` James S. Rogers
2003-01-30 3:42 ` Steve
0 siblings, 2 replies; 3+ messages in thread
From: Sam T @ 2003-01-29 17:58 UTC (permalink / raw)
Hey,
I need to round a float to 2 decimal points
Any ideas?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Newbie Question: Floating Point Decimal Rounding
2003-01-29 17:58 Newbie Question: Floating Point Decimal Rounding Sam T
@ 2003-01-29 20:09 ` James S. Rogers
2003-01-30 3:42 ` Steve
1 sibling, 0 replies; 3+ messages in thread
From: James S. Rogers @ 2003-01-29 20:09 UTC (permalink / raw)
"Sam T" <samst@btinternet.com> wrote in message
news:b194ob$uv$1@saturn.bton.ac.uk...
> Hey,
> I need to round a float to 2 decimal points
> Any ideas?
Yep.
My idea is that you want the output rounded to two
decimal places. This is done using the AFT parameter of
the Put procedure instantiated from Ada.Text_Io.Float_IO,
or from the pre-instantiated package Ada.Float_Text_IO.
Ada.Float_Text_Io.Put(Item => YourValue,
Aft => 2,
Exp => 0);
Jim Rogers
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Newbie Question: Floating Point Decimal Rounding
2003-01-29 17:58 Newbie Question: Floating Point Decimal Rounding Sam T
2003-01-29 20:09 ` James S. Rogers
@ 2003-01-30 3:42 ` Steve
1 sibling, 0 replies; 3+ messages in thread
From: Steve @ 2003-01-30 3:42 UTC (permalink / raw)
You could use:
float'Rounding( value * 100.0 ) / 100.0;
Steve
(The Duck)
"Sam T" <samst@btinternet.com> wrote in message
news:b194ob$uv$1@saturn.bton.ac.uk...
> Hey,
> I need to round a float to 2 decimal points
> Any ideas?
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-01-30 3:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-29 17:58 Newbie Question: Floating Point Decimal Rounding Sam T
2003-01-29 20:09 ` James S. Rogers
2003-01-30 3:42 ` Steve
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox