MathGroup Archive 2011

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

Search the Archive

Re: avoiding non-machine numbers

  • To: mathgroup at smc.vnet.net
  • Subject: [mg115633] Re: avoiding non-machine numbers
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Mon, 17 Jan 2011 05:37:08 -0500 (EST)

The difference could be 4GB of RAM here, speed of the hard drive, other  
applications running... who knows?

Bobby

On Sun, 16 Jan 2011 04:53:51 -0600, Achilleas Lazarides  
<achilleas.lazarides at gmx.com> wrote:

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


-- 
DrMajorBob at yahoo.com


  • Prev by Date: Re: Tooltip in a Plot of a List
  • Next by Date: Re: Help on compiling a function
  • Previous by thread: Re: avoiding non-machine numbers
  • Next by thread: Re: avoiding non-machine numbers