# Can I force Mathematica to use machine precision? [duplicate]

Some built-in functions (like Exp) give an arbitrary precision result, even when the argument is a machine precision number. Example:

Exp[-10.] // Precision


MachinePrecision

Exp[-1000.] // Precision


12.9546

I can of course Clip and Chop the result to a machine precision number, but I would like to avoid the cost of arbitrary precision calculations (and unpacking, if the argument is a packed array) in the first place. For example here:

x = Range[-10.^6, 10.^6];
Timing[y = Exp[-x^2/2];]
PackedArrayQ[y]


The calculation takes 7s on my PC (machine precision calculation would take ~0.1s) and the result isn't a packed array.

## marked as duplicate by Oleksandr R., Niki Estner, xzczd, DumpsterDoofus, Yves KlettJan 9 '15 at 14:49

• The only thing I can think of at the moment is Compile, is it of interest? – xzczd Jan 9 '15 at 13:47
• Thanks @OleksandrR., SystemSetSystemOptions["CatchMachineUnderflow" -> False]; works perfectly. I did look for similar questions, but didn't find the one you linked. It's obviously a duplicate. Should delete it myself or vote to close? – Niki Estner Jan 9 '15 at 13:59
• We may as well VTC so that this can serve as another pointer to help other people search in the future. As @xzczd says, Compile can also work, and if you don't feel like setting a global option, the Compile option "RuntimeOptions" -> {"CatchMachineUnderflow" -> False}` could be a good alternative. – Oleksandr R. Jan 9 '15 at 14:00