MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: avoiding non-machine numbers


It made far less difference here:

switchCatchUnderflow[] := (SetSystemOptions[
      CatchMachineUnderflow -> #1] &)[! CatchMachineUnderflow /.
    SystemOptions[CatchMachineUnderflow]]

Exp[-#^2] &@RandomReal[NormalDistribution[0, 20], 400000]; // Timing
switchCatchUnderflow[];
Exp[-#^2] &@RandomReal[NormalDistribution[0, 20], 400000]; // Timing

{1.54747, Null}

{1.4913, Null}

$Version

"8.0 for Mac OS X x86 (64-bit) (November 6, 2010)"

Bobby

On Sat, 15 Jan 2011 03:47:22 -0600, Achilleas Lazarides  
<achilleas.lazarides at gmx.com> wrote:

> 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
>


-- 
DrMajorBob at yahoo.com


  • Prev by Date: Tooltip in a Plot of a List
  • Next by Date: Re: NSolve unable to find all possible roots
  • Previous by thread: Re: avoiding non-machine numbers
  • Next by thread: Re: avoiding non-machine numbers