0
$\begingroup$

I want to set MaxPrecision low, to like 2 decimals, but after I set it, it stays at 5 regardless.

I've tried using two commands:

Block[{$MaxPrecision = 2}, 1.555555 + 2]

and simply:

 $MaxPrecision = 2

and then enter some calculations.

Am I doing something wrong?

$\endgroup$

1 Answer 1

1
$\begingroup$
$Version

"12.1.1 for Mac OS X x86 (64-bit) (June 19, 2020)"

Clear["Global`*"]

Any expression in which a machine precision number appears will produce a machine precision result

Block[{$MaxPrecision = 2}, {val = 1.555555 + 2, val // InputForm, 
  Precision[val]}]

enter image description here

Block[{$MaxPrecision = 2}, {val = SetPrecision[1.555555, 2] + 2, 
  val // InputForm, Precision[val]}]

enter image description here

$\endgroup$
2
  • $\begingroup$ Thanks for the correct code, it works perfectly. Is there any way to write it as an option for matrix decomposition operation, something like JacobDecomposition[mat] // Precision[2] ? I'm asking because I need to decompose a matrix that includes numbers with sign " ` " and I can't substitute them with floating type numbers like 0` with 0. because that symbol disappears in the "Find & replace" window. Or is 0` so small it can be deleted? $\endgroup$
    – Svit
    Oct 24, 2020 at 16:38
  • $\begingroup$ mat // SetPrecision[#, 2] & $\endgroup$
    – Bob Hanlon
    Oct 24, 2020 at 16:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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