Reputation: 14044
How does Mathematica decide when to round numbers in its output? For example,
giving the input
250000.5
gives the output
2500001
While
25000.5
is indeed printed as
25000.5
N[] isn't helpful here either, I need to use NumberForm[] to get it to actually print 250000.5 as 250000.5
I'm a Mathematica newbie, and I'm sure its ridiculously easy to control this threshold for when it starts ignoring decimals in its output, but could somebody please point me in the right direction?
Upvotes: 3
Views: 4131
Reputation: 24336
Nasser is correct that PrintPrecision
is the right setting.
You have a number of options for its use. You can set it Globally or for the specific Notebook using the Options Inspector. You can also use it directly with Style
:
Style[250000.5, PrintPrecision -> 10]
250000.5
You can set it temporarily for one session like this:
SetOptions[$FrontEndSession, PrintPrecision -> 10]
Finally you can set it using Style Sheets (select cell type Output
).
Upvotes: 6
Reputation: 13131
another option for you to try, you can go to options and change the default PrintPrecision
from 6 to say 16, and now you will see that it will print what you typed above
after I changed that to 16 (click on the field itself, and type 16 into the field to replace the 6, and hit return), then
Upvotes: 6
Reputation: 2537
In the default TraditionalForm
and StandardForm
output modes Mathematica only shows a certain number of most significant digits. You can use InputForm
to get the full precision number.
Upvotes: 2