|
Boost : |
Subject: Re: [boost] Review Request: Algorithm.Sorting
From: Steven Ross (spreadsort_at_[hidden])
Date: 2009-05-06 22:43:17
Does this ease your mind? float_sort shouldn't compile if the float type
isn't correct, and this is the code I've been using for casting floats to
integers:
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);
Cast_type result;
std::memcpy(&result, &(*floatiter), sizeof(Data_type));
Also, the mostly-sorted performance issue is resolved; performance is now
comparable on Windows between integer_sort and std::sort on mostly-sorted
data, without any platform-specific edits.
That should resolve all outstanding concerns I am aware of.
On Wed, May 6, 2009 at 1:26 PM, Ross Levine <ross.levine_at_[hidden]> wrote:
> On Mon, Apr 27, 2009 at 10:32 AM, Steven Ross <spreadsort_at_[hidden]>
> wrote:
>
> > float_sort, which sorts IEEE floating-point numbers as integers
>
>
> This worries me a little. C++ floating-point format is
> implementation-defined, and is not necessarily in IEEE 754.
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk