ML == MathLab? Well, of course MathLab would go to great trouble to minimize
this issue as much as possible, including doing its calculations in such a
way that it preserves fractional representations and evaluates by truly
combining expressions and doing simplification, as opposed to rote
calculation to a numerical value then substitution.

I also wouldn't be surprised if ML didn't explicitly handle common Pi
constants. While it absolutely wouldn't be an optimization for standard trig
functions (it doesn't take many lookups on modern CPU's before just letting
the floating-point unit do its thing to be faster -- and if you start
choosing 'shortcuts' you'll never make everyone happy).

Troy.


On 9/17/07, Mike Krotscheck <[EMAIL PROTECTED]> wrote:
>
>  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
>
> [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