Re: vector of bin indices using histogram? [message #50777 is a reply to message #50775] |
Wed, 18 October 2006 08:33   |
Foldy Lajos
Messages: 268 Registered: October 2001
|
Senior Member |
|
|
On Wed, 18 Oct 2006, David Fanning wrote:
> Paolo Grigis writes:
>
>> You might also want to change the computation of b with
>> a division into a multiplication by the reciprocal (see
>> example below).
>>
>> x=fltarr(5d7)
>>
>> t=systime(/seconds)
>> y=x/2.
>> print,systime(/seconds)-t
>> 0.82191920
>>
>> t=systime(/seconds)
>> y=x*(1./2)
>> print,systime(/seconds)-t
>> 0.33465910
>
> Well, that's interesting. Do you have a theory about this? :-)
>
CPU latency. Eg. for Pentium 4, the latency is 7 clock cycles for
FMUL, and 43 for FDIV (this is worst case, depends on the data, and
assumes that the data is in the L1 cache). Decent compilers (including
FL :-) replace division by float const by multiplication.
regards,
lajos
|
|
|