I am using sage-4.0.rc0 on 32 bit ubuntu 8.10. I have discovered a very strange interaction between the "Integer=int" declaration, division, and the number of times a worksheet is evaluated.
Consider the following worksheet. The very first time it is evaluated, division is handled as float division, and the results are what I hoped for. But, if I evaluate the cell again, I get a different answer. This time the division seems to be python integer division, and I get a different result. I keep getting this second result until I restart the worksheet, then I get the first result for a single evaluation. Regardless of what the correct behaviour is, I would hope to get the same behaviour every time I evaluate the worksheet. This looks like a bug to me. ================================ First evaluation after restarting worksheet: Division Error? system:sage {{{id=2| Integer=int print float(500/1000), float(1000/1000) print float(500/1000.), float(1000/1000.) /// 0.5 1.0 0.5 1.0 }}} ================================ Second and subsequent evaluation: Division Error? system:sage {{{id=2| Integer=int print float(500/1000), float(1000/1000) print float(500/1000.), float(1000/1000.) /// 0.0 1.0 0.5 1.0 }}} Note: I am using the RealNumber=float; Integer=int declarations to avoid errors when specifying axis parametres for matplotlib plots. I may need to start wrapping each of those parametres in float() instead. -- Kevin Horton Ottawa, Canada --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---