1 | initial version |
This is because many different "floating-point" numbers display as 1.27.
See my answer to this other Sage question for an explanation of a related phenomenon: https://ask.sagemath.org/question/40024/why-is-ab-false/.
One workaround might be to use a string representation of these numbers as keys to your dictionary:
str(f(x))
instead of f(x)
as a key when building your dictionarypreimages['1.27']
to get the preimages of 1.27