math module broken?
Dan Bishop
danb_83 at yahoo.com
Sat Jul 24 15:44:30 EDT 2004
More information about the Python-list mailing list
Sat Jul 24 15:44:30 EDT 2004
- Previous message (by thread): math module broken?
- Next message (by thread): math module broken?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Dan Sommers <me at privacy.net> wrote in message news:<m2hdrxr1iz.fsf at unique.fully.qualified.domain.name.yeah.right>... > On 23 Jul 2004 23:00:18 -0700, > danb_83 at yahoo.com (Dan Bishop) wrote: > > > danb_83 at yahoo.com (Dan Bishop) wrote in message news:<ad052e5c.0407231555.53f3ea11 at posting.google.com>... > > >> def mysin(x): > >> return math.sin(math.radians(x)) > > > Even better: > > > def mysin(x): > > return math.sin(math.radians(x % 360)) > > Why? > > >>> for x in range( 20 ): > print '%.12f %.12f' % (math.sin( math.radians( x ) ), math.sin( math.radians( x % 360 ) )) > [2 identical columns] It's not suprising that they're identical: When 0 <= x < 360, then x % 360 == x. However, >>> x = 360000000000L # a billion revolutions >>> math.sin(math.radians(x)) -6.6394736764063769e-08 >>> math.sin(math.radians(x % 360)) 0.0
- Previous message (by thread): math module broken?
- Next message (by thread): math module broken?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list