RE: [flexcoders] Math.cos...?

2007-09-17 Thread Gordon Smith
s +∞, the result is NaN. • If x is −∞, the result is NaN. - Gordon From: Gordon Smith Sent: Monday, September 17, 2007 2:49 PM To: 'flexcoders@yahoogroups.com' Subject: RE: [flexcoders] Math.cos...? That would be a bad idea because it would lead to dis

RE: [flexcoders] Math.cos...?

2007-09-17 Thread Gordon Smith
@yahoogroups.com Subject: Re: [flexcoders] Math.cos...? Math.cos() (and every other trig function) should check the argument being PI (or any other of its own constants) before calculating, since it would better reflect the mathematical function and maybe even save up on some performance. On 9/17

Re: [flexcoders] Math.cos...?

2007-09-17 Thread Jon Bradley
On Sep 17, 2007, at 4:49 PM, Mike Krotscheck 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. You could do that.

RE: [flexcoders] Math.cos...?

2007-09-17 Thread Mike Krotscheck
: 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 resul

Re: [flexcoders] Math.cos...?

2007-09-17 Thread Troy Gilbert
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 > *Su

Re: [flexcoders] Math.cos...?

2007-09-17 Thread Guido
if the argument passed to > Math.cos() is exact, the result generally won't be. > > - Gordon > > -- > *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On > Behalf Of *Jon Bradley > *Sent:* Sunday, September 16, 2007 2:49 PM > *To

RE: [flexcoders] Math.cos...?

2007-09-17 Thread Gordon Smith
ed to Math.cos() is exact, the result generally won't be. - Gordon From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Jon Bradley Sent: Sunday, September 16, 2007 2:49 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Math.cos...?

RE: [flexcoders] Math.cos...?

2007-09-16 Thread Samuel R. Neff
ck 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, F

RE: [flexcoders] Math.cos...?

2007-09-16 Thread Mike Krotscheck
D] <mailto:[EMAIL PROTECTED]> 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 er

Re: [flexcoders] Math.cos...?

2007-09-16 Thread Jon Bradley
That's pretty much it. To a computer Math.cos(Math.PI/2) is not 0. It's really close to 0, because PI is an infinite sequence and a computer can "only" store it as a double precision floating point number (ie, a fixed value). What you get back from this calculation is the error bound of the

Re: [flexcoders] Math.cos...?

2007-09-16 Thread Troy Gilbert
> 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.