# Make mathematica “forget” numbers beyond the precision goal

I need Mathematica to remember only things upto two decimal places.

I'm currently using the unwieldy Floor[x*100]/100 which works but is there a better way to make it use two decimal places (throughout the notebook is okay).

I tried N[x,{2,2}] but although it displays the requisite two decimal places, I know that the kernel still remembers. For instance, if I try it for N[1.234,{2,2}]-1.23 is not 0. It is in fact 0.004. How can I get rid of this?

• Examine FullForm@N[1.234, {2, 2}] and you'll see it's not doing what you think it is doing. Try instead SetAccuracy[1.234, 2] - 1.232. One problem using this approach is that Mathematica tracks relative precision, not a fixed number number of decimal places. Do you want fixed-point arithmetic or is just about output formatting? – Michael E2 Nov 3 '15 at 11:24

You want Round[] for this:

Round[1.234, 1.*^-2] - 1.23
0.


This can be used with $PrePrint if needed. To make your function work "throughout the workbook" you can use: $PrePrint = N @ Floor[#*100]/100 &;


Now

 {1.23999, Pi}


{1.23, 3.14}

Restore $PrePrint to the default: $PrePrint =.