[NetBehaviour] The trouble with rounding floating point numbers.
Marcus Kirsch
marcus at unvoid.net
Tue Aug 15 15:31:07 CEST 2006
i guess doubles are then the variable equivalent of butterflies then .......
my question as uninitiated would be was the error gone or just so small
now that it didnt remain visible
marCus
> Quoting marc <marc.garrett at furtherfield.org>:
>
>> That's right, one of the most basic operations in math, a thing that
>> we learn to do before we can ride a bike, eludes the combined efforts
>> of the finest engineers over the last 30 years. Of course, this is
>> something that is intuitively nonsensical - why should it be
>> impossible to round a floating-point number reliably?
>
> Real mathematics programmers use bignums. ;-)
>
> http://en.wikipedia.org/wiki/Bignum
>
> I remember the first time I saw a floating point rounding error. A
> student I was
> teaching was rotating a vector shape on the screen by multiplying the
> angle by a
> fraction in a loop. The numbers were stored as C floats. As the shape
> rotated it
> started to drift off-centre. I had difficulty believing that floats were
> the
> problem given the low ranges being used, but after asking the maths
> lecturer's
> advice we switched the code from using floats to using doubles. The shape
> then
> rotated without drifting.
>
> - Rob.
>
> _______________________________________________
> NetBehaviour mailing list
> NetBehaviour at netbehaviour.org
> http://www.netbehaviour.org/mailman/listinfo/netbehaviour
>
--
Marcus Kirsch
MA (RCA) Interaction Designer and Technoartist
London, UK
+44 (0) 7950 177633
marCus at resonancedesign.co.uk
More information about the NetBehaviour
mailing list