Message Boards Message Boards

0
|
3379 Views
|
4 Replies
|
4 Total Likes
View groups...
Share
Share this post:

Display Precision for Real number

Posted 9 years ago

How can one adjust the number of significant figures in displayed output of computation in one particular instance without change in global precision setting? N doesn't seem to do the job:

N[{1193.3258943578567`, -1.4105256234179098`, 0.1297736143358147`}, 3]
POSTED BY: Al Guy
4 Replies

Look at the documentation on NumberForm

POSTED BY: Frank Kampas
Posted 9 years ago

I have some situation like this:

InputField[Dynamic[ww]]
Button["ok", ww = RandomReal[]]

Where the output of computation is feeded back into InputField line but because computation is done with high precision the Field's line is flooded with digits, but I need it to display some approximate value. NumberForm doesn't seem to work here.

POSTED BY: Al Guy
Posted 9 years ago

I didn't realize, it's trivial: SetPrecision

POSTED BY: Al Guy

But you said

How can one adjust the number of significant figures in displayed output

So it seems to be the right solution is to do formatting only, which only affect the display of the number on the output device. So as was suggested, you need to use one of Mathematica's formatting functions. Another option is to use Style as in Style[x, PrintPrecision -> 3]

POSTED BY: Nasser M. Abbasi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract