comp.lang.ada
 help / color / mirror / Atom feed
From: "Marin David Condic" <dont.bother.mcondic.auntie.spam@[acm.org>
Subject: Re: rounding floating point numbers
Date: Wed, 20 Feb 2002 17:53:29 -0500
Date: 2002-02-20T22:53:30+00:00	[thread overview]
Message-ID: <a519da$3vo$1@nh.pace.co.uk> (raw)
In-Reply-To: yfVc8.96077$as2.15328940@news6-win.server.ntlworld.com

Multiply by one hundred & convert to integer. Convert the integer back to
float and divide by one hundred.

Or you can invent a fixed point type with appropriate precision and do some
type conversions. Depends a lot on what sort of features you need the
numbers to have....

You can also find lots of help doing things like rounding, truncation,
floor, ceiling, etc., by looking in the "Annex K: Language-Defined
Attributes" in the ARM.

MDC
--
Marin David Condic
Senior Software Engineer
Pace Micro Technology Americas    www.pacemicro.com
Enabling the digital revolution
e-Mail:    marin.condic@pacemicro.com
Web:      http://www.mcondic.com/


"Fraz" <fraz@totalise.co.uk> wrote in message
news:yfVc8.96077$as2.15328940@news6-win.server.ntlworld.com...
> 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
>
>





  reply	other threads:[~2002-02-20 22:53 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 [this message]
2002-02-20 23:24 ` David C. Hoos
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