One might also consider adding 0.5 after scaling, as 0.005 does not have
an exact IEEE binary floating point representation.


IMHO. YMMV.
--
Ron Nicholson
HotPaw
http://www.hotpaw.com/rhn/hotpaw/

(In some other forums, one might suspect that a high school student
is asking questions like this in order to get answers to his or her
homework assignment...)

--
Fitzpatrick, Joe  writes:
>Wouldn't it be:
>
>Add .005, then... ?
>
>-----Original Message-----
>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
>
>Sent: Monday, March 13, 2000 2:44 PM
>To: Palm Developer Forum
>Subject: Re: How do I round a float to 2 decimal places????
>
>
>
>
>Multiply by 100, print as an integer, decorate as necessary.
>
>-- Keith
>
>
>
>
>
>
>Steve Sabram <[EMAIL PROTECTED]> on 03/12/2000 09:03:55 AM
>
>Please respond to "Palm Developer Forum"
><[EMAIL PROTECTED]>
>
>Sent by:  Steve Sabram <[EMAIL PROTECTED]>
>
>
>To:   "Palm Developer Forum" <[EMAIL PROTECTED]>
>cc:    (Keith Rollin/HQ/3Com)
>Subject:  Re: How do I round a float to 2 decimal places????
>
>
>
>
>Don't be.  There is no facility for this on the OS.  You will need to
>write your
>own rounding routine.
>
>Steve
>
>Palm Programming wrote:
>
>> I feel stupid asking this, but how to I take a float that I have
>calculated
>and format it so that
>> it is rounded to 2 decimal places when I turn it into a string???????
>Help!
>>
>> Steve Weintraut
>> [EMAIL PROTECTED]

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palm.com/devzone/mailinglists.html

Reply via email to