On Tuesday 08 February 2005 21:11, Stephane Pinel wrote:
> Hello,
>
> When I try to insert decimal numbers like 12857.59, 13858.58 or
> 14785.60, they are inserted as 12857.58, 13858.57 and 14785.59 ?!
>
> DataType is DECIMAL 10,2
>
> Any idea of a way to avoid this annoying issue ?
>
> Thanks.
>
> Regards.
>
> Stéphane.
Is this Windows/PHP, perchance? The double-precision floating point maths PHP
uses isn't always precise. Values are stored as binary numbers, which may
only be approximations of their decimal values. For instance, on 32-bit
Windows, the following evaluates as false:
Seventenths is an irrational number in binary maths, you see.
You'd do well to make sure that it isn't actually your operating system,
that's munging your values, rather than MySQL. If it is PHP, try echoing your
INSERT statements, before they are executed, to see what is actually being
inserted.
(Otherwise, I haven't a clue, so ignore me :).
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]