[issue8309] Sin(x) is Wrong

2010-04-04 Thread Derek O'Connor
Derek O'Connor added the comment: @ Tim Peters " ... are much keener about speed than avoiding noise results for inputs in ranges they *never intend to use* ". It is the *unintended use* that worries me. Sadly, "Speed is King". Perhaps that aphorism should be "Speed is Ki(lli)ng". @ Mark Di

[issue8309] Sin(x) is Wrong

2010-04-04 Thread Mark Dickinson
Mark Dickinson added the comment: > We could similarly take on porting and maintaining KC Ng's fdlibm Gulp. If we did that, I'd definitely want to push for dropping Python support for non-IEEE 754 systems. I'm not sure I've fully recovered from the dtoa.c addition yet. :) -- _

[issue8309] Sin(x) is Wrong

2010-04-04 Thread Tim Peters
Tim Peters added the comment: At heart, this is really the same kind of thing that eventually prodded Python into adopting David Gay's burdensome ;-) code for correctly rounded double<->string I/O conversions. We could similarly take on porting and maintaining KC Ng's fdlibm (an open source

[issue8309] Sin(x) is Wrong

2010-04-04 Thread Mark Dickinson
Mark Dickinson added the comment: > Python 3.1.2 -- 32 bit gives sin(2^60) = -0.7391806966492228 Interesting. I get >>> sin(2.**60) -0.83064921763725463 On both OS X 10.6.3 (64-bit build) and OS X 10.5.something (32-bit build). But this is all down to the platform math library, of course.

[issue8309] Sin(x) is Wrong

2010-04-04 Thread Derek O'Connor
Derek O'Connor added the comment: Reply to Mark Dickinson Python 3.1.2 -- 32 bit gives sin(2^60) = -0.7391806966492228 PariGp 2.3.4 gives sin(2^60) = -0.8306492176372546505752817956 So it seems Intel's x87 FSIN is not being used. Application? I don't have one, but it is not too hard

[issue8309] Sin(x) is Wrong

2010-04-04 Thread Mark Dickinson
Mark Dickinson added the comment: What Ilya Sandler said! Computing sin or cos with large arguments requires high precision for the intermediate calculations (e.g., for sin(1e22) you'd need around 40 digits of precision for the reduction step), so most math libraries don't bother. This is

[issue8309] Sin(x) is Wrong

2010-04-03 Thread Eric Smith
Changes by Eric Smith : -- nosy: +eric.smith type: performance -> behavior ___ Python tracker ___ ___ Python-bugs-list mailing list Uns

[issue8309] Sin(x) is Wrong

2010-04-03 Thread Ilya Sandler
Ilya Sandler added the comment: I believe python is fully at mercy of underlying system math library. And as a matter of fact, this C program #include #include main() { printf("%.6f\n", sin(1e22)); } when compiled as 64-bit app (on linux) produces "-0.852201", but when it's compiled as a 3

[issue8309] Sin(x) is Wrong

2010-04-03 Thread Ezio Melotti
Changes by Ezio Melotti : -- nosy: +mark.dickinson stage: -> test needed ___ Python tracker ___ ___ Python-bugs-list mailing list Unsu

[issue8309] Sin(x) is Wrong

2010-04-03 Thread Derek O'Connor
New submission from Derek O'Connor : 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) >>> Py