New submission from Derek O'Connor <derekrocon...@eircom.net>: 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 ---------- components: Library (Lib) messages: 102312 nosy: derekroconnor severity: normal status: open title: Sin(x) is Wrong type: performance versions: Python 3.1 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue8309> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com