
Johan Råde wrote:
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,
and he writes corresponding tests, jamfiles, documentation and includes support for the variety of compilers and libraries that boost supports.
I will add it to my code.
A very good answer. The problem at hand is to define otherwise undefined behavior that currently, can result in non-sensical programs. Your solution addresses that problem. If someone wants to address some other problem, facets can be written for that and included in the "facets library". People regularly have problems with the current situtation. When someone proposes a solution, a bunch of other people chime in with their proposal to expand the problem to the point of insolubility. The task is then too large to address and the situation goes back to where it was before. This is a boost problem.
--Johan Råde
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost