Author derekroconnor
Recipients derekroconnor
Date 2010-04-04.01:04:30
SpamBayes Score 1.71813e-11
Marked as misclassified No
Message-id <1270343074.04.0.0881828805303.issue8309@psf.upfronthosting.co.za>
In-reply-to
Content
Dell Precision 690, Intel 2xQuad-Core E5345  @ 2.33GHz
16GB RAM, Windows7 64-bit Professional.

Python 3.1.2 (r312:79149, Mar 21 2010, 00:41:52) 
[MSC v.1500 32 bit (Intel)] on win32

>>> from math import sin
>>> sin(1e22)
0.41214336710708466   (WRONG)
>>>

Python 3.1.2 (r312:79149, Mar 20 2010, 22:55:39)
[MSC v.1500 64 bit (AMD64)] on win32

>>> from math import sin
>>> sin(1e22)
-0.8522008497671888  (CORRECT)

The correct result, rounded to 20 digits is

 sin(10^22) = -8.5220 08497 67188 80177 e-001

Please note that 10^22 is exactly representable as an IEEE double precision floating point number, whose binary representation is

10^22 = 1000011110000110011110000011001001101110101011001001 x 2^22

Hence fl(10^22) = 10^22, whereas fl(10^23) ~= 10^23.

This incorrect result suggests that the range-reduction step, where the argument x is reduced to lie in a small interval around 0, such as [-pi/2,+pi/2], has not been done properly. This means that the other trigonometric functions will be incorrect.

Yours sincerely,

Derek O'Connor
History
Date User Action Args
2010-04-04 01:04:34derekroconnorsetrecipients: + derekroconnor
2010-04-04 01:04:34derekroconnorsetmessageid: <1270343074.04.0.0881828805303.issue8309@psf.upfronthosting.co.za>
2010-04-04 01:04:32derekroconnorlinkissue8309 messages
2010-04-04 01:04:30derekroconnorcreate