comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » sin() function in IDL 4.0.1
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
sin() function in IDL 4.0.1 [message #5773] Mon, 12 February 1996 00:00 Go to previous message
Miska Le Louarn is currently offline  Miska Le Louarn
Messages: 8
Registered: December 1995
Junior Member
Hello,
I just found an interesting behaviour of the sine function:
when I ask IDL (4.0.1) to calculate sin(pi) here is what I get:

IDL> print,sin(!Dpi)
1.2246064e-16 ; This should be 0.0000... (?)

On the other hand, sin(0) works fine:
IDL> print,sin(0D0)
0.0000000 ; This seams to be a "real" 0
I also tested cos(!Dpi):
IDL> print,cos(!Dpi)
-1.0000000
and cos(0D0):
IDL> print,cos(0D0)
1.0000000

Another different behaviour is:
IDL> print,cos(!Dpi/2D0)
6.1230318e-17


So my question is: why are there two different kind of zeroes ? is it a
bug ? a "feature" ? or maybe simply a format question (the result is
sometimes rounded...)
I know that there can be round-off errors and things like that, so
I am not surprised by the answer itself but rather by the difference
between within what should be the same...

Has anyone a good explanation for that ?

Thanks
Miska

--


* Miska Le Louarn Phone: (49) (89) 32006472 *
* ESO - European Southern Observatory FAX : (49) (89) 3202362 *
* Karl-Schwarzschild Strasse 2 e-mail: lelouarn@eso.org *
* D-85748 Garching bei Munchen *
* Federal Republic of Germany *
[Message index]
 
Read Message
Read Message
Previous Topic: Help with WIDGET_TEXT (non-) events
Next Topic: Molecular Modelling really possible with pv-wave?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:58:03 PDT 2025

Total time taken to generate the page: 0.00434 seconds