[NumPy-Tickets] [NumPy] #1996: sin(180) != 0

NumPy Trac numpy-tickets@scipy....
Wed Dec 14 03:23:40 CST 2011


#1996: sin(180) != 0
-------------------------+--------------------------------------------------
  Reporter:  ilshat      |       Owner:  somebody      
      Type:  defect      |      Status:  closed        
  Priority:  normal      |   Milestone:  Unscheduled   
 Component:  Other       |     Version:  1.3.0         
Resolution:  worksforme  |    Keywords:  numpy.math sin
-------------------------+--------------------------------------------------
Changes (by rkern):

  * status:  new => closed
  * resolution:  => worksforme


Comment:

 This is the most precise answer. 0 would be a less precise answer. math.pi
 is not exactly the irrational number pi, just 64-bit floating point
 approximation to it. sin() does not know that you really intended the real
 irrational number pi. It only knows that you pass it something that is
 almost but not quite pi.

 If you want to use degrees, try the sindg() function in scipy.special.
 sindg(180 + 360*n) == 0 exactly for all integer n (at least up to a very
 large n where precision issues become a problem).

 In any case, the math module is not part of numpy. Please report issues
 concerning it on the Python bug tracker.

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/1996#comment:1>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list