Re: avoiding non-machine numbers
- To: mathgroup at smc.vnet.net
- Subject: [mg115588] Re: avoiding non-machine numbers
- From: Achilleas Lazarides <achilleas.lazarides at gmx.com>
- Date: Sat, 15 Jan 2011 04:47:22 -0500 (EST)
I have this in my init.m:
switchCatchUnderflow[]:==(SetSystemOptions[CatchMachineUnderflow->#1]&)[!CatchMachineUnderflow/.SystemOptions[CatchMachineUnderflow]]
which flips the option indicated. I get:
In[65]:== Exp[-#^2] &@
RandomReal[NormalDistribution[0, 20], 400000]; // Timing
switchCatchUnderflow[];
Exp[-#^2] &@RandomReal[NormalDistribution[0, 20], 400000]; // Timing
Out[65]== {1.62773, Null}
Out[67]== {0.12662, Null}
On Jan14, 2011, at 12:17 PM, wpb wrote:
> t == RandomReal[NormalDistribution[0, 20], 400000];
> Exp[-t^2]; // Timing