| 1 | initial version |
The behavior you observe is due to the floor division // having a higher precedence than the subtraction operator - but a lower precedence than the negative operator -, see the table of operator precedence. Compare:
sage: a = 8^2 - 3^2; a
55
sage: b = 6^2 - 9*8; b
-36
sage: n(a/b)
-1.52777777777778
sage: a//b
-2
sage: 0 - a//b # subtraction operator
2
sage: - a//b # negative operator
1
sage: 0 + (- a//b) # different from 0 - a//b
1
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.