MathGroup Archive 2011

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

Search the Archive

Re: avoiding non-machine numbers

  • To: mathgroup at smc.vnet.net
  • Subject: [mg115626] Re: avoiding non-machine numbers
  • From: Achilleas Lazarides <achilleas.lazarides at gmx.com>
  • Date: Mon, 17 Jan 2011 05:35:48 -0500 (EST)

Strange, I just tried again and got the same answer:
In[9]:== Exp[-#^2] &@
   RandomReal[NormalDistribution[0, 20], 400000]; // Timing
switchCatchUnderflow[];
Exp[-#^2] &@RandomReal[NormalDistribution[0, 20], 400000]; // Timing
switchCatchUnderflow[];
$Version


Out[9]= {1.66873, Null}

Out[11]= {0.130301, Null}

Out[13]= "8.0 for Mac OS X x86 (64-bit) (November 6, 2010)"

No difference after quitting and restarting the kernel etc.


On Jan15, 2011, at 9:07 PM, DrMajorBob wrote:

> 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: Re: How to force numeric output
  • Next by Date: Re: Making a table with unlinked sliders
  • Previous by thread: Re: avoiding non-machine numbers
  • Next by thread: Re: avoiding non-machine numbers