# Not getting requested numerical precision

I am trying to do some calculations of probability and have run into an issue where Mathematica won't give me the requested number of digits in the result.

prob = (.95*(1 - 1/20000))/(.95*(1 - 1/20000) + .075*(1/20000))

N[prob, 30]

N[1/prob, 30]


The value of prob = .999996, but I get 1/prob = 1. As you can see I am trying to get more digits for the 1/prob calculation but without success. It still doesn't work even if I copy the entire expression into N[1/prob].

What is the correct way to do this, and why is this happening?

• Any calculation that contains a machine precision number will result in a machine precision result. N[prob, 30] // Precision will show that you get MachinePrecision. Apr 23, 2020 at 2:37

As you can see I am trying to get more digits for the 1/prob calculation but without success

They are there. Try this

SetOptions[\$FrontEndSession, PrintPrecision -> 30]
prob = (.95*(1 - 1/20000))/(.95*(1 - 1/20000) + .075*(1/20000));
N[prob, 30];
N[1/prob, 30]


which prints

1.0000039475657994


From help, it says

PrintPrecision is an option for selections that specifies the maximum number of digits used for displaying a machine-precision number.

(note, it says machine-precision number)

But if you want the computation itself done in 30 Precision, then try

prob = SetPrecision[(.95*(1 - 1/20000))/(.95*(1 - 1/20000) + .075*(1/20000)), 30]
(*0.999996052449783956461715206387*)

1/prob

(* 1.00000394756579925776199085484 *)


And now you do not need to change or use PrintPrecision at all to see those digits.