Message Boards Message Boards


Digit precision with N command when working with machine precision numbers

Posted 9 years ago
3 Replies
0 Total Likes

I have something like this:

N[Mean[{3.81913, 243.354}], 3]

It outputs


because the mean of that list is a Machine Precision number and then, N[ ] does nothing. How can I force Mathematica to show the number of digits I want in a case like this one?

POSTED BY: Daniel Solis
3 Replies

SetPrecision[...,3] should do this.

POSTED BY: Daniel Lichtblau


N[Mean[Rationalize@{3.81913, 243.354}], 3]

is one way to go.... when you are working with machine precision numbers then machine precision arithmetic is used throughout the calculation.

POSTED BY: David Reiss

Thanks!, both options worked.

POSTED BY: Daniel Solis
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract