|
Posted by Andy Hassall on 09/01/06 19:31
On Fri, 1 Sep 2006 11:26:09 -0400, Lazeez Jiddan
<lazeez@storiesonline.removethispart.net> wrote:
>Is mysql unable to store 9.7 as 9.7 float and uses some kind of
>approximation?
Yes, this is a common issue on computers. The IEEE standard for floating point
numbers only represents a subset of numbers; some precision is traded for
range.
The closest you can get to 9.7 is 9.699999809265137.
The closest you can get to 9.8 is 9.800000190734863.
See http://www.h-schmidt.net/FloatApplet/IEEE754.html
>if so, is there a way to get the results that I'm looking for without
>some stupid workaround like changing 9.7 (or whatever the score sought)
>to 9.69 (or whatever is close)?
Multiply all your values by 100 and store in an integer format. Divide them
back down by 100 for display.
--
Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Navigation:
[Reply to this message]
|