---------- Forwarded message ---------- From: Greg Ewing <[EMAIL PROTECTED]> Date: Feb 20, 2007 7:10 PM Subject: Re: [Pyrex] Integer exponentiation returns a double To: didier deshommes <[EMAIL PROTECTED]> Cc: [EMAIL PROTECTED]
didier deshommes wrote: > Robert > Bradshaw found that when a and b are cdef'ed as integers, the result > of a**b is a double. Pyrex's philosophy is that when operating on two things both defined as C data types, the operation that should be done is the one that makes the most sense from a C point of view. In the case of **, this means translating it into a call to the C pow() function. Since C doesn't provide any integer-only power operation, the only alternative would be to convert them to Python ints and return a Python int or long. Since that's an expensive thing to do, I think it's better if the programmer needs to be explicit about it. To avoid misleading people into creating bugs, it might be better to disallow ** on C ints altogether, although that would be surprising in another way, since C ints are normally promoted to floats automatically wherever appropriate. -- Greg On Feb 20, 4:48 pm, "didier deshommes" <[EMAIL PROTECTED]> wrote: > On 2/20/07, Robert Bradshaw <[EMAIL PROTECTED]> wrote: > > > > > Last night we discovered a really bad bug in SageX when doing a**b > > (with a, b cdef'ed). > > Robert, > I've forwarded this to the pyrex mailing list > > didier --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~----------~----~----~----~------~----~------~--~---