I may take you up on this challenge- I've got this strange masochistic
urge to see if ML has the same restriction. I seem to recall proving e^i
to an arbitrary significant digit, so Pi shouldn't be too much
different.

 

Michael Krotscheck

Senior Developer

 


RESOURCE INTERACTIVE

<http://www.resource.com/> www.resource.com <http://www.resource.com> 

[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Samuel R. Neff
Sent: Sunday, September 16, 2007 11:30 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Math.cos...?

 

 

It's not sloppy, it's just how floating point numbers work.  Try the
same thing in other programming languages and you still will not get
zero (unless they round the output).  For example, .NET reports the
result as 

6.12303176911189E-17.  

 

Sam

-------------------------------------------
We're Hiring! Seeking a passionate developer to join our team building
Flex based products. Position is in the Washington D.C. metro area. If
interested contact [EMAIL PROTECTED]
  

 

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Mike Krotscheck
Sent: Sunday, September 16, 2007 5:19 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Math.cos...?

The documentation's actually fairly clear on this: "The cosine of a 90
degree angle is zero, but because of the inherent inaccuracy of decimal
calculations using binary numbers, Flash Player will report a number
extremely close to, but not exactly equal to, zero."

 

Nevertheless, it seems... sloppy to me.

 

Michael Krotscheck

Senior Developer

 


________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Troy Gilbert
Sent: Sunday, September 16, 2007 5:15 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Math.cos...?

 

> Why does Math.cos(Math.PI/2) not return zero?

Round-off error in the Math libs? It does return a value very close to
0 (1.7xe-17).

Troy.

 

Reply via email to