Message Boards Message Boards


[✓] Get two significant digits to the right of the decimal point?

Posted 1 year ago
3 Replies
3 Total Likes

N[x,3] gives me 1.10 and 0.982, when what I want is 0.98. How do I get two and only two digits to the right of the decimal point?

3 Replies
N[x, {Infinity, 2}]

provided x is not of machine precision (MachinePrecision).

Posted 1 year ago


If it is the formatting that is of interest rather than the underlying value, could use DecimalForm[0.982,{Infinity,2}] This is new in version 11.2 I think, but there are ways to attain the same in prior versions using NumberForm.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract