I would use sprintf to format a string, and then use that string as a number. Mike
______________________________________________________________________
"Experience is the comb that Nature gives us after we are bald."
Is that a haiku?
I never could get the hang
of writing those things.
Why not leave the variable alone, and just control it's output / display with printf for example.
If you must change it perhaps you could do it with a re-ex.
This code should take reduce it to a maximum of two decimal places. If their is no decimal portion to this number then it will assign the old_double value (an integer). If you must have two decimal places you could use further reg-ex tests on the new double,
check for a decimal, if not assign two 0's:
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.