
Paul A Bristow wrote:
Johan Råde wrote: | Paul A. Bristow wrote:> | | > Surely C99 signbit tests the sign bit?
| You are right, but our goals are different. You are working on a | proposal to the C++ standardization committee. I writing code that | should work with existing C++ compilers and std lib | implementations. So I can not assume that the C99 signbit macro is present.
OK, so why not write - or get someone else to write ;-) a C++ is_negative function, and use the signbit macro if available, or make up your own bit test if not?
There are a few variations with type, endianness and compiler, of course, but not TOO many?
I'm not going to do it. I don't need the sign bit in Nan (and 0), and I don't want to dig into the binary representation of floating point numbers on different platforms. If anyone needs it, let him write it. If he does, I will add it to my code. --Johan Råde