Flasher Archive

[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]


Subject: Re: [flasher] Floating point coordinate calculation bug
From: John Dowdell
Date: Tue, 06 Mar 2001 23:17:45 -0000

If this boils down to "How can I compare floating point values?" then try
searching the Macromedia Director Technotes with term "floating point".
This brings up the background and a way to solve the case.

(There are Flash technotes on this too, but the Director technotes,
particularly #13112, are written more from the reader's point of view than
the writer's point of view.)

Recap: Computers can represent integers exactly, but floats inexactly.
Instead of testing equality on floats, see whether they're very close to
each other, as in:
if (Math.abs(numA - numB) < .000001) {....

jd





John Dowdell, Macromedia Tech Support, San Francisco CA US
Search technotes: http://www.macromedia.com/support/search/
Offlist email risks capture by the spam filters. I may not see your
email if it's not on the list. Private one-on-one email options are
available via Priority Access: http://www.macromedia.com/support/





[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]