tn wrote:
tn Wrote:

--------------------
int      []     271
int      [)     271
int      (]     283
int      ()     285

long     []     372
long     [)     399
long     (]     401
long     ()     397

float    []     286
float    [)     374
float    (]    5252
float    ()    5691

double   []     348
double   [)     573
double   (]    5319
double   ()    5875

real     []     434
real     [)     702
real     (]    2832
real     ()    3056
--------------------

In my opinion floating point uniforms with (] or () as boundary types are unacceptably slow. I had 
to use 1 - uniform!"[)"(0.0, 1.0) instead of uniform!"(]"(0.0, 1.0) because of 
this issue. I would also expect versions using float and double to be faster than the version using 
real.

After further investigation it seems that the slowdown happens because of 
subnormal numbers in calculations. If there is an open boundary at zero then 
the call of nextafter in uniform returns a subnormal number. Perhaps next 
normal number could be used instead?

No, it just shouldn't convert (] into []. It should do [], and then check for an end point. Since the probability of actually generating a zero is 1e-4000, it shouldn't affect the speed at all <g>.

Reply via email to