Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Bug or desired behavior of eval?

I am fairly certain this is a bug, but I wanted to ask here before reporting it on trac. I understand that when we enter something in sage, like

sage: 5/3
5/3

We want to receive 5/3 instead of the normal python output:

>>> 5/3
1.6666666666666667

However, eval in sage seems to be rounding down:

sage: eval('5/3')
1

Where I would expect it to return 5/3 again, or at the very least 1.6666666666666667 (if eval ran through python first and had already returned 1.6666666666666667). The standard eval in python does return 1.6666666666666667.

Bug or desired behavior of eval?

I am fairly certain this is a bug, but I wanted to ask here before reporting it on trac. I understand that when we enter something in sage, like

sage: 5/3
5/3

We want to receive 5/3 instead of the normal python output:

>>> 5/3
1.6666666666666667

However, eval in sage seems to be rounding down:

sage: eval('5/3')
1

Where I would expect it to return 5/3 again, or at the very least 1.6666666666666667 (if eval ran through python first and had already returned 1.6666666666666667). The standard eval in python does return 1.6666666666666667.