Re: Problems with decimal numbers

2005-02-09 Thread DanielWalker
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]



Re: Query problem

2005-02-09 Thread DanielWalker
On Tuesday 08 February 2005 17:03, Coz Web wrote:
>
> This will (as I believe Daniel suggested) keep things relatively
> simple, avoiding an overly complex query that you cannot maintain in
> the future.

Well, my solution was, as you'll have observed, vastly over-complicated. I 
think I'd misunderstood the nature of the problem (or I'm just too bunged up 
with cold, at the moment, to think straight :-/ - whichever)...

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]