--- In [email protected], "Samuel Neff" <[EMAIL PROTECTED]> wrote:
>
> If you want to know to compare two values with tolerance then
subtract them
> and see if the result is within your tolerance.
> 
> public function within(x:Number, y:Number, tolerance:Number):Boolean {
>   var difference:Number = x - y;
>   return difference <= tolerance && difference >= - tollerance;
> }
> 
> HTH,
> 
> Sam
> 
> -----------------------------------------------------------------
> We're Hiring! Seeking passionate Flex, C#, or C++ (RTSP, H264)
developer in
> the Washington D.C. Contact [EMAIL PROTECTED]
> 
> On Mon, Jul 14, 2008 at 3:07 PM, fumeng5 <[EMAIL PROTECTED]> wrote:
> 
> > Hi,
> >
> > I'm trying to compare 3 points but because of double precision in AS3
> > i'm running into some issues with trailing digits causing the numbers
> > to not be equal, i.e. 1.25 != 1.2499999999999
> >
> >
> >
>
Thanks for the responses:

Tim, I need more precision than rounding to the nearest integer, but
thank you. 

Lampei, that solution sounded perfect at first but I was running into
problems when I started passing over 900 points to be compared. 

Sam, this looks like exactly what I am looking for. My test cases seem
to be passing so far and all is well. 

Thank you for all the quick responses. 

fumeng. 

Reply via email to