Subject: Re: [boost] sorting floats by casting to integer
From: Steven Ross (spreadsort_at_[hidden])
Date: 2009-07-18 17:00:57
On Mon, Jul 6, 2009 at 3:33 PM, Christopher Jefferson <chris_at_[hidden]
>> I still have a problem: what's a good floating-point benchmark?
> Possibly a stupid thing to say -- rather than trying to massage bits like
> this, why not just generate floats directly, something like rand() *
> pow((float)10, rand()%20) for example?
So that all possible bit combinations can be exercised, making sure there is
no corner-case where sorting is incorrect.
My tests do these things at the same time:
1) Verify correctness (most important)
2) Benchmark performance
3) Identify weak points to be used for tuning or so the user can know when
not to use the algorithm as appropriate for their system.
Additionally, the tests and testcase generation need to run quickly so they
can be both accurate and finish in a reasonable amount of time.
I think the best way to do this is to generate semi-random bits, and for the
case of floats, to specifically eliminate denormalized numbers and NaNs.
Generating them the way you suggest may be better for goal #2, but worse for