Sign up ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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?

share|improve this question
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.23``2. 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 at 11:24

2 Answers 2

up vote 2 down vote accepted

You want Round[] for this:

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

This can be used with $PrePrint if needed.

share|improve this answer

To make your function work "throughout the workbook" you can use:

$PrePrint = N @ Floor[#*100]/100 &;


 {1.23999, Pi}

{1.23, 3.14}

Restore $PrePrint to the default:

$PrePrint =.
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.