And it can be fixed by inserting p = sage.rings.integer.Integer(p)
after p is generated by range. Comments on this still welcome. This may be a dumb question but now I'm worried that perhaps this problem exists silently elsewhere in my code. On Friday, February 15, 2019 at 2:56:14 PM UTC-8, Michael Beeson wrote: > > def test(p,q): > t = p/q; > print(p,q,p/q,t) > def test2(): > for p in range(1,4): > for q in range(1,4): > test(p,q) > > sage: test2() > > (1, 1, 1, 1) > > (1, 2, 0, 0) > > (1, 3, 0, 0) > > (2, 1, 2, 2) > > (2, 2, 1, 1) > > (2, 3, 0, 0) > > (3, 1, 3, 3) > > (3, 2, 1, 1) > > (3, 3, 1, 1) > > sage: test(*2*,*3*) > > (2, 3, 2/3, 2/3) > > sage: version() > > 'SageMath version 8.0, Release Date: 2017-07-21' > > > When test(2,3) is executed at top-level, 2/3 is not cast to an integer. > But when > > it is executed inside test2, 2/3 becomes 0. Why? and how to prevent it? > > > > -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at https://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.