Ask Your Question

Revision history [back]

Once you use a numerical approximation, you probably shouldn't do further arithmetic and then another approximation (such as applying int) and expect reliable results. The number you're getting is very close to 8, just a little smaller, so when int truncates it, the result is 7.

sage: 8-(49/6-(1/6*1.n()))

Perhaps it would be better to use round instead of int: int is a built in Python function, while round is better suited to work with Sage number types. In general, though, it's probably best not to use .n() until the end of the calculation.