0

When I run

Rationalize[2.98688387095, 0]

I get $\frac{117300079}{39271724}$

However, when I run

N[117300079/39271724, 50]

I get

2.986883870949999546747680341204272060987

But what I really wanted was

2.986883870950000000000000000000000000000

How can I find the exact rational form of 2.98688387095?

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
Thiago
  • 311
  • 1
  • 9
  • 2
    Per the linked question, you could try FromDigits @ RealDigits @ 2.98688387095. – Carl Woll Apr 13 '18 at 01:43
  • 1
    As I explain in my answer to the question linked by Carl, Rationalize[num, 0] doesn't give an exact rational conversion. You instead need Rationalize[num\z,0], where (simplifying from my answer) z>= twice the number of digits in the number. So, for your case, using a z of 100 (far more than enough), we have:x = Rationalize[2.98688387095`100, 0]andN[x, 50] = 2.9868838709500000000....` – theorist Apr 13 '18 at 07:01

0 Answers0