From: John Maddock (john_at_[hidden])
Date: 2008-02-26 09:04:23
John Maddock wrote:
> 1) Floating point classification routines: these are optimised
> implementations of the C99 and C++ TR1 functions fpclassify, isinf,
> isnan, isnormal and isfinite. From Boost-1.35 onwards these are
> already a part of Boost.Math (see
> so if accepted the two implementations will get merged.
> The review here should focus on the implementation used, and testing
> on whatever platforms you have available - in particular are there any
> circumstances (compiler optimisation settings etc) where this
> implementation breaks?
These look fine to me, and as Johan mentioned, any breakages should be fixed
Sorry to bring this up again (!), but I've been trying to get my head around
the aliasing rules and what is and isn't allowed, in particular by following
the rather useful article here:
>From this it appears that your current code is perfectly fine, however I
still can't help feeling that we could do better than call an external
function (memcpy) to move 4 or 8 bytes. The suggestion in the article is to
use a union to move from one type to another:
boost::uint32_t get_bits(float f)
u.f = f;
I can't claim to have tested exhaustively, but modifying get_bits and
set_bits to use this method seems to work OK for VC8&9 and Minwg GCC.