math module broken?

Delaney, Timothy C (Timothy) tdelaney at avaya.com
Fri Jul 23 03:12:39 EDT 2004


Frank Millman wrote:

> 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

>>> import math
>>> math.sin(math.radians(32))
0.5299192642332049

The python trigonometric functions use radians. The Microsoft calculator
(and the textbook) use degrees.

You need to convert from degrees to radians to get the correct results.

Tim Delaney



More information about the Python-list mailing list