From: "David C. Hoos" <david.c.hoos.sr@ada95.com>
Subject: Re: rounding floating point numbers
Date: Wed, 20 Feb 2002 17:24:21 -0600
Date: 2002-02-20T17:24:21-06:00 [thread overview]
Message-ID: <mailman.1014247142.10712.comp.lang.ada@ada.eu.org> (raw)
In-Reply-To: yfVc8.96077$as2.15328940@news6-win.server.ntlworld.com
Bear in mind that floating point numbers cannot exactly represent
fractional decimal values, unless the fractional part happens to be
an integer multiple of a negative integer power of 2 -- e.g. 0.5,
0.25, 0.75, etc.
Further, the maximum number of digits approximately expressible
in floating point representation is constrained by the declaration
of the floating point type -- e.g., type My_Float is digits 6;
Are you sure you want to use floating point? Have you considered
decimal Fixed_Point types?
----- Original Message -----
From: "Fraz" <fraz@totalise.co.uk>
Newsgroups: comp.lang.ada
To: <comp.lang.ada@ada.eu.org>
Sent: Wednesday, February 20, 2002 4:17 PM
Subject: rounding floating point numbers
> Hi
>
> How do i round a floating number to 2 decimal places? I know u can use
> Fore, Aft, Exp in the PUT command, but i want to pass the number as
> a paramater to something else, but i only want it to 2 decimal places? is
> there a way to store the number like this in a variable?
>
> Fraz
>
>
> _______________________________________________
> comp.lang.ada mailing list
> comp.lang.ada@ada.eu.org
> http://ada.eu.org/mailman/listinfo/comp.lang.ada
>
next prev parent reply other threads:[~2002-02-20 23:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-02-20 22:17 rounding floating point numbers Fraz
2002-02-20 22:53 ` Marin David Condic
2002-02-20 23:24 ` David C. Hoos [this message]
2002-02-21 2:29 ` Steve Doiel
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox