0

I have an expression with lots of numbers such as

1.000000002, 2.0000000000001, ...

and I would like to automatically set them to

1, 2, ...

how can I do that?

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574

1 Answers1

1

A friend of mine gave me a nice answer and I will post it here for completeness.

Use "Rationalize".

  • 5
    Simple Rationalize /@ {1.000000002, 2.0000000000001} doesn't work, you'll have to specify a "catching range": something like Rationalize[#, 10^-8] & /@ {1.000000002, 2.0000000000001}. – Roman Feb 28 '19 at 16:04
  • 1
    This would have been a good answer if you had included an example of how Rationalize[] solves your problem. – J. M.'s missing motivation Mar 01 '19 at 09:18