Re: Floor Decimal Math

2008-05-21 Thread Paul DuBois
On May 16, 2008, at 2:42 AM, Adam de Zoete wrote: Thanks for your responses, i thought it was a float problem so i was trying to CAST as a DECIMAL to fix it. It turns out (and the manual does not document this) that casting as decimals doesn't actually work in mysql 4.1.20. ROUND() is need

Re: Floor Decimal Math

2008-05-16 Thread Adam de Zoete
Thanks for your responses, i thought it was a float problem so i was trying to CAST as a DECIMAL to fix it. It turns out (and the manual does not document this) that casting as decimals doesn't actually work in mysql 4.1.20. ROUND() is needed instead. mysql> select ROUND(11.11-FLOOR(11.11),2)>

RE: Floor Decimal Math

2008-05-15 Thread John Trammell
> -Original Message- > From: Adam de Zoete [mailto:[EMAIL PROTECTED] On Behalf Of > Adam de Zoete > Sent: Thursday, May 15, 2008 6:24 AM > To: mysql@lists.mysql.com > Subject: Floor Decimal Math > > Hi, > > I'm running mysql 4.1.20 (Mac OS 10.4.11) and wondering why this ain't > returning t

RE: Floor Decimal Math

2008-05-15 Thread Jerry Schwartz
Don't feel bad, many an experience programmer has been bitten by this. The problem is that many decimal fractions do not have exact representations as binary fractions. .01 is an example of this. I'm not sure how MySQL does arithmetic internally, but (11.11 - 11) is just a hair under .11: mysql>

Re: Floor Decimal Math

2008-05-15 Thread wim . delvaux
On Thursday 15 May 2008 13:24:10 Adam de Zoete wrote: > Hi, > > I'm running mysql 4.1.20 (Mac OS 10.4.11) and wondering why this ain't > returning the right answer? Maybe i'm missing something or am i doing > something wrong? Perhaps it is performing FLOAT and not DECIMAL math. 11.11 is represent