Ask Your Question

Revision history [back]

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:

  • use str(f(x)) instead of f(x) as a key when building your dictionary
  • then use preimages['1.27'] to get the preimages of 1.27