Re: [sage-support] Difference between sage and pyhton calculations

2010-04-06 Thread Robert Bradshaw
On Apr 6, 2010, at 12:17 AM, Paul Zimmermann wrote: If one wants to have the same answer as Python does (always nonnegative), then function math.fmod can be used. For example, sage: from math import fmod sage: fmod(6e-6,10e-6) 6.0002e-06 first Python does not always give a nonneg

Re: [sage-support] Difference between sage and pyhton calculations

2010-04-06 Thread Paul Zimmermann
> If one wants to have the same answer as Python does (always nonnegative), > then function math.fmod can be used. For example, > sage: from math import fmod > sage: fmod(6e-6,10e-6) > 6.0002e-06 first Python does not always give a nonnegative result: >>> (6e-6) % (-10e-6) -4.000

Re: [sage-support] Difference between sage and pyhton calculations

2010-04-06 Thread Paul Zimmermann
> >> sage > >> Sage Version 4.3.5, Release Date: > >> 2010-03-28 > >> sage: 1+1 > >> 2 > >> sage: 6e-6 % 10e-6 > >> -4.00e-6 > >> > >> I'm sure sage is wrong.. :( > > > > They're both the same... > > No they aren't. > > If you type > > sage: s = 6e-6 > sage: s.__mod__?? > > then you

Re: [sage-support] Difference between sage and pyhton calculations

2010-04-05 Thread Robert Bradshaw
On Apr 5, 2010, at 9:44 PM, William Stein wrote: On Mon, Apr 5, 2010 at 9:12 PM, Michael Welsh wrote: On 6/04/2010, at 3:56 PM, Eugene Goldberg wrote: Hello! Here is my pyhtons results: python Python 2.6.5 (r265:79063, Mar 23 2010, 04:49:54) [GCC 4.4.3] on linux2 Type "help", "copyright"

Re: [sage-support] Difference between sage and pyhton calculations

2010-04-05 Thread William Stein
On Mon, Apr 5, 2010 at 9:12 PM, Michael Welsh wrote: > > On 6/04/2010, at 3:56 PM, Eugene Goldberg wrote: > >> Hello! >> >> Here is my pyhtons results: >> >> python >> Python 2.6.5 (r265:79063, Mar 23 2010, 04:49:54) >> [GCC 4.4.3] on linux2 >> Type "help", "copyright", "credits" or "license" for

Re: [sage-support] Difference between sage and pyhton calculations

2010-04-05 Thread Michael Welsh
On 6/04/2010, at 3:56 PM, Eugene Goldberg wrote: > Hello! > > Here is my pyhtons results: > > python > Python 2.6.5 (r265:79063, Mar 23 2010, 04:49:54) > [GCC 4.4.3] on linux2 > Type "help", "copyright", "credits" or "license" for more information. 1+1 > 2 6e-6 % 10e-6 > 6.000

[sage-support] Difference between sage and pyhton calculations

2010-04-05 Thread Eugene Goldberg
Hello! Here is my pyhtons results: python Python 2.6.5 (r265:79063, Mar 23 2010, 04:49:54) [GCC 4.4.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> 1+1 2 >>> 6e-6 % 10e-6 6.0002e-06 >>> and here is sage: ./ sage Sage Version 4.3.5, Release Dat