Boost logo

Boost :

Subject: Re: [boost] sorting library proposal (Was: Review Wizard Status Report for June 2009)o
From: Vladimir Prus (vladimir_at_[hidden])
Date: 2009-06-03 12:37:11


Steven Ross wrote:

> You can sort floats by casting them to integers and accounting for the
> flipped representation of negatives.
> Comparison-based sorting of floats is over an order of magnitude slower on
> x86 systems I've tried relative to an old Altivec.
> On the Altivec runtime of comparison-based sorting of floats is comparable
> to that for sorting integers.

Then, should you actually have this:

      BOOST_STATIC_ASSERT(sizeof(Cast_type) == sizeof(Data_type));
      BOOST_STATIC_ASSERT(std::numeric_limits<Data_type>::is_iec559);
      BOOST_STATIC_ASSERT(std::numeric_limits<Cast_type>::is_integer);

I would have expected sorting to work on whatever I throw to it -- a user might
not even know what iec559 is. In other works, can you enable cast to int conditionally?

And while we are at it, I am not sure that 'float_sort' is good name -- it is very
generic and closes the door for different algorithm that might sort floats.

- Volodya


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk