1

Let

x= 0.0000000000000000036;

y = 1 - x

If i type this in Mathematica the answer of y is 1. I want the answer to be as it is 0.9999999999999999964

Nikolas
  • 105
  • 9
  • x=1/277777777777777769... or as inexact but showing digits 1 - 0.0000000000000000036`2 – ciao Jul 05 '14 at 21:31
  • @rasher. Mathematica rounds it up to unity istead of showing me the answer 0.9999999...64 – Nikolas Jul 05 '14 at 21:37
  • If you're on pre- 9.x, you might need to change the "displayed precision" option under "appearance->Formatting" in preferences. Try adding //InputForm to the end of your calculation, see what you see... If you're using N to convert exact to inexact, make sure you specify enough precision in it. – ciao Jul 05 '14 at 21:44
  • @rasher. Neither work. I set the displayed precision to 20decimal and still the same. Also //InputForm does not change anything – Nikolas Jul 05 '14 at 21:48

2 Answers2

2
    x = SetPrecision[0.0000000000000000036, 1];
    y = 1 - x

(*0.9999999999999999964*)
Basheer Algohi
  • 19,917
  • 1
  • 31
  • 78
2

Amplifying on Algohi's answer

Table[{
   x = SetPrecision[0.0000000000000000036, n],
   Precision[x],
   1 - x,
   Precision[1 - x]},
  {n, 10}] // Grid

enter image description here

Bob Hanlon
  • 157,611
  • 7
  • 77
  • 198