>From: MySQL <mysql@stripped>
> From: "Madscientist" <madscientist@stripped>
> You might also consider using two integer type fields - one for the
> numerator and another for the denominator. This way storage and recovery are
> easy and the mathematics are wide open.
>I suspect that a float add is faster than 3 integer multiplies and
Ah, but it is not as accurate!
If the original poster knows he needs fractions, he won't be happy with float.
Just as one should NEVER use floating point to represent money, one should NEVER use it
for representing fractions that need to be precise. For example, (1/3 as a float) * 3
will come out to 0.99999999.
: Jan Steinman -- nature photography: <http://www.Bytesmiths.com>
: Bytesmiths -- artists' services: <http://www.Bytesmiths.com/Services>
: Join the forums at <http://www.Bytesmiths.com/wiki>