Excuse me please, but is there any sort of workaround yet to this? It is preventing me from running python code that expects 2/3=0.6666... in notebook mode...
Thank you, Mats On Jun 17, 12:59 pm, Mats <[EMAIL PROTECTED]> wrote: > It seems that "from __future__ import division" works in console mode, > but does not work in notebook mode. > Running the commands quoted below will yield the expected results in > the console mode (.6666...), but 2/3 will equal 0 in notebook mode. > > Sincerely, > Mats > > On Jun 15, 1:36 pm, "William Stein" <[EMAIL PROTECTED]> wrote: > > > On Sun, Jun 15, 2008 at 10:12 AM, Nick Alexander <[EMAIL PROTECTED]> wrote: > > > > On 15-Jun-08, at 6:45 AM,Matswrote: > > > >> Hello, > > > >> I've done Integer=int, but however it seems that after I do "from > > >> __future__ import division", I still get 2/3=1. > > > > Can you give an example? > > > The original poster is claiming that the following doesn't work: > > > D-69-91-137-77:~ was$ sage > > ---------------------------------------------------------------------- > > | SAGE Version 3.0.2, Release Date: 2008-05-24 | > > | Type notebook() for the GUI, and license() for information. | > > ---------------------------------------------------------------------- > > > sage: from __future__ import division > > sage: 2/3 > > 2/3 > > sage: Integer = int > > sage: 2/3 > > 0.66666666666666663 > > > Actually it does, so .... ? > > > >> This does not occur in > > >> the python interpreter; I get .666666... as I should. > > > > If you mean that you find > > > > sage: 2/3 > > > .66666 > > > > then something is very strange. By default, the sage interpreter > > > preparses '2/3' to 'Integer(2)/Integer(3)' which evaluates to a > > > Rational, namely 2/3. So you should get > > > > sage: 2/3 > > > 2/3 > > > > You can turn off the preparser -- preparse? might give you useful > > > information and examples. > > > > Examples of what you want to do would be useful. > > > Nick > > > -- > > William Stein > > Associate Professor of Mathematics > > University of Washingtonhttp://wstein.org --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to [email protected] 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://www.sagemath.org -~----------~----~----~----~------~----~------~--~---
