1

I try to calculate something like 1.569732312*Pi and by default mathematica returns something like 4.93146 (only 5 digits after floating point), but I believe there is much more digits, especially because Pi has infinite number of digits.

if I do like this

N[1.569732312*Pi, 50]

It still return the same 5 digits 4.93146

As I understand from documentation, I have to use Rationalize[]. If I do like this

N[Rationalize[1.569732312]*Pi, 50]

result is the same 4.93146

and only if I remove 3 digits like this

N[Rationalize[1.569732]*Pi, 50]

it gives me all digits like this

4.9314585193048133197984421233221006214165911156199

What I am doing wrong and how to calculate 1.569732312*Pi with 50 digits precision?

Zlelik
  • 531
  • 2
  • 8
  • 1.569732312`50*Pi - note the backtick. See also here. – corey979 Oct 31 '16 at 22:18
  • Thanks a lot! Yes, if I put something like 1.569732312`50*Pi, it works fine. – Zlelik Oct 31 '16 at 22:32
  • 1.569732312 is a machine double. What 50 digit result would you expect to get from that product? (If you want a 50 digit number that has 1.569732312 followed by decimal zeroes, the tactic of using 1.569732312`50 as proposed by @corey979 is appropriate). – Daniel Lichtblau Oct 31 '16 at 22:33
  • I want to know the result of my equation. Like Pi=3.1415926...., If I multiple it by 2, it will be 6,2831852, but I want to know all 50 digits of this equation 2*Pi, because Pi has infinite digits. and later I want to change 2 to some different number. – Zlelik Oct 31 '16 at 22:49
  • you should review the details section in the docs for Rationalize to learn whats happening there. – george2079 Nov 01 '16 at 00:55
  • Rationalize[1.569732312] evaluates to 1.569732312 since from the documentation for Rationalize "Rationalize[x] yields x unchanged if there is no rational number close enough to x to satisfy the condition |p/q-x| < c/q^2, with c chosen to be 10^-4." Use Rationalize[x, 0] to Rationalize any number. – Bob Hanlon Nov 01 '16 at 02:20
  • @BobHanlon Good point, thanks. I did not know. – Zlelik Nov 02 '16 at 21:56

1 Answers1

1

It is about backtick. This example works fine

1.569732312`50*Pi
Zlelik
  • 531
  • 2
  • 8