Excel: SIN(PI()) not = 0????
Excel: SIN(PI()) not = 0????
(OP)
Does anybody know why I'd get
Sin(pi()) = 1.22515 E-16 and Sin(2*pi()) = 2.4503 E-16 ?
For what it's worth, I get the same thing with Sin(radians(180)).
Sin(0), Sin(pi()/2), and Sin(3*pi()/2) all work.
I get the same type of problem (different magnitude and shifted 90°) with cosine.
Sin(pi()) = 1.22515 E-16 and Sin(2*pi()) = 2.4503 E-16 ?
For what it's worth, I get the same thing with Sin(radians(180)).
Sin(0), Sin(pi()/2), and Sin(3*pi()/2) all work.
I get the same type of problem (different magnitude and shifted 90°) with cosine.





RE: Excel: SIN(PI()) not = 0????
sin(5) = -0.9589
sin (3) = 0.14112
Now thinking back to our calculus classes (ouch) the sine graph at pi was 0 for all practical purposes. So my guess is that 2 pi is next 0 of the sine graph from below the 0 line.
I've just checked my old faithful calculus text and guess what the graph of sine and cosine are in it. pi, 2pi, etc are graphed as 0 and cosine is at factors of pi/2, hence the 90 deg shift.
regards
sc
RE: Excel: SIN(PI()) not = 0????
I have asked MS about it once before and they basically shrugged the shoulders and said it doesn't really effect anything. Seems to be a very poor rounding error buried in excel.
sc
RE: Excel: SIN(PI()) not = 0????
Also, I would think it can comes from the kind of number PI is assigned to (Real, Float, etc...) that might have an influence on calculus sharpness
Cyril Guichard
Mechanical Engineer
RE: Excel: SIN(PI()) not = 0????
I'm just happy to know it's Excel and not my processor.
RE: Excel: SIN(PI()) not = 0????
RE: Excel: SIN(PI()) not = 0????
I would've thought that MS would at least include their own rounding like they did in their windows desktop calculator.
It just goes to show that Excel was not designed as an engineering/scientific tool but as a business tool.
RE: Excel: SIN(PI()) not = 0????
They don't give a spec for the accuracy of the trig functions, that I could find.
I suspect that to force the answer to the expected one most people include an exception statement
sin(x)=if x=any_integer*pi then 0 else sin(x)
or so on.
Excel just lets you do the hard work!
Cheers
Greg Locock
RE: Excel: SIN(PI()) not = 0????
Those who made mathcad propably just inserted a special clause that ensures that mathcad returns 0 to sin(PI) no matter what.
Best regards
Morten
RE: Excel: SIN(PI()) not = 0????
The symbolic processor returns 0, because it knows that multiples of pi are supposed to return specific values.
TTFN