0

Is it possible to find the nearest exact form of an irrational number if the decimal number is given? Suppose i only have $6$ digits i.e. $3.14159$ the output should tell me one of the possibilities is $\pi$. I don't have any attempts since i have no idea how to do this. Hope you can help me.

user516076
  • 373
  • 1
  • 8
  • 1
    There is NO nearest irrational number to a rational number: rat (number with finite decimal representation), because to any specific irrational number that is close to rat, there is an infinity of irrational numbers that are closer. – Daniel Huber Mar 22 '21 at 21:59
  • If you have a decimal representation of a number x, Rationalize[x] will put it into exact rational form. Of course, there is no decimal representation of $\pi$ that can be stored on a computer, and as @DanielHuber says, there is no rational number closest to any irrational number. – thorimur Mar 23 '21 at 04:11
  • 1
    If you suspect that it is a multiple of Pi: x = 3.14159; Pi*Round[x/Pi, 10^-5] or x = 1.5708; Pi*Round[x/Pi, 10^-5] – Bob Hanlon Mar 23 '21 at 06:20

0 Answers0