Check out Bill Ezell's web page:

http://www.mv.com/users/wje/pilot.html

Near the bottom of the page is a link to source code that is called "fp.c".
I believe this code is for converting floats to strings, but can be easily
modified to handle doubles.

I found this information by using news.massena.com, in the
pilot.programmer.gcc newsgroup.  Don't let the "gcc" worry you.  This code
works fine in both GCC andCodeWarrior.

Ed
----- Original Message -----
From: "amit saini" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Saturday, September 09, 2000 3:29 AM
Subject: Re: How to get more then 8digits without rounding off


> Hi,
>  Thanks a lot For the Help .
> Iam still facing a problem and its like this
> if d=2222222233 then mantisa is 22222222 its Ok
> if d=2222222288 then mantisa is 22222223 thatis in
> mantisa it rounds the number .now in this
> circumstances even if I follow the solution suggested
> by u result will be very different.
>
> If u can  send me then please send me the Whole rotine
> to convert double to a Sting.
> Your Reply will be a great HELP to me.
>
> Thanks
> AmitSaini
>
>
> --- Andreas Hofer <[EMAIL PROTECTED]> wrote:
> > This routine won't give you more than 8 digits,
> > since the mantissa parameter
> > is a 32 bit integer and cannot hold greater numbers.
> > You will have to write
> > some code.
> >
> > An idea how you can do this is to use FlpBase10Info
> > to get the exponent and
> > the upper 8 digits of the mantissa. Then you
> > calculate the number z =
> > mantissa * (10**exponent) which is the original
> > number rounded to 8 digits.
> > Then subtract z from the original number and feed
> > the result again into
> > FlpBase10Info to get the next 8 digits.
> >
> > For example:
> > x = 3.14159265358979324;
> > FlpBase10Info -> Mantissa = 31415926, exp = -7
> > z = 31415926 * 10**-7 = 3.1415926
> > x-z = 3.14159265358979324 - 3.1415926 =
> > 0.00000005358979324
> > FlpBase10Info -> Mantissa = 53589793, exp = -15
> >
> > You need to take care to insert leading or trailing
> > zeroes correctly into
> > the resulting string and to place the decimal period
> > at the correct place
> > for all kind of numbers.
> >
> > Andreas
> >
> >
> >
> > --
> > For information on using the Palm Developer Forums,
> > or to unsubscribe, please see
> http://www.palmos.com/dev/tech/support/forums/
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Mail - Free email you can access from anywhere!
> http://mail.yahoo.com/
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/
>


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to