I'm developing for BlackBerry 4.2.1 and i'm facing a difficult problem. I want to convert a float to String without the scientific notation. I'm using Float#toString(float f) but it gives an scientific notation back. According to the javadoc, "If m is less than 10-3 or not less than 107, then it is represented in so-called "computerized scientific notation."".
Another problem is there's no NumberFormat class available either.
So i started writing my own formatter, the requirement is formatting floating point numbers with a maximum precision of 10. This is what i have so far:
This works but not for big floating point numbers because of line 24. Here i try to calculate the remainder.
I do this by subtracting the float value with the int value. But first multiply it with a large number because subtracting float numbers is imprecise. The problem is the multiplication with the large number (pow) which can exceed the maximum long size.
Anyway, some help with setting the remainder in the StringBuffer would be appreciated.