Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Sage is correctly telling you that for no integer x in the set 0,1,2,3,...,99, the equation x+0.75==20 holds.

Beware that testing for exact equality with floats is a certain source for bugs, because rounding errors will cause computations that mathematically should result in the same answers, to result in different ones. For example:

sage: [x for x in range(100) if float(x)+float(2/3) == float(1+2/3)]
[]

(whereas, of course, x=1 would be a mathematical solution)

Note, by the way, that this behaviour is basically just python.