Converting doubles to strings

2003-03-04 Thread Brad Figler
for converting doubles to strings? I don't need the string in exponential format, I just need the string to have 1 or 2 places precision. An example of the problem I am seeing is the following. User enters a number 1.2 I convert that to a double using the float manager. I get 1.2 I multiply

Re: Converting doubles to strings

2003-03-04 Thread John Marshall
On Tue, Mar 04, 2003 at 09:15:41AM -0700, Brad Figler wrote: Can someone suggest a recommended method for converting doubles to strings? It's quite hard in general. The canonical reference IMHO is Steele and White, How to print floating-point numbers accurately, SIGPLAN '90. That was a both

Re: Converting doubles to strings

2003-03-04 Thread Brad Figler
(long) (x + 0.5) I thought everyone learnt this trick in primary school? Or at home, while programming in BASIC as a child? It is funny that you say that, because now that I see that, I cannot believe I did not remember it. Thanks for reminding me. Actually, what I did was re-write it from

Re: Converting doubles to strings

2003-03-04 Thread Alan Ingleby
Use GetStringFromDouble. It's been posted here several times, and beleive me, it works 100%. I use it frequently. Here it is again, in case you missed it, along with it's partner GetDoubleFromString. // == void GetStringFromDouble(Char* str, double dblNum, Int16

Re: Converting doubles to strings

2003-03-04 Thread Brad Figler
(long) (x + 0.5) I am going to lose sleep over this one tonight. I am such an [EMAIL PROTECTED]@[EMAIL PROTECTED] -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/