math module broken?

Frank Millman frank at
Fri Jul 23 09:01:25 CEST 2004

Hi all

I was helping my niece with her trigonometry homework last night. Her
calculator's batteries were flat, so I thought I would use Python's
math module to calculate sin, cos, and tan.

I tried the example in the text book first, to ensure that I was
getting the correct result, but it did not agree. Then my wife had the
idea of using the Microsoft calculator in scientific mode, and that
one did give the correct result.

Here are some examples -

sin(32) -
    Python    0.55142668
    Microsoft 0.52991926

cos(32) -
    Python    0.83422336
    Microsoft 0.84804809

tan(32) -
    Python    0.66100604
    Microsoft 0.62486935

Version is Python 2.3.3. I get the same results on Linux and on
Windows 2000. I also get the same results using the cmath module.

Can someone please explain these discrepancies?


Frank Millman

More information about the Python-list mailing list