
-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Guillaume Melquiond Sent: 25 February 2008 21:49 To: boost@lists.boost.org Subject: Re: [boost] Floating Point Utilities Review starts today
As I explained in a previous mail, the sign bit is not part of the NaN payload. So a standard-compliant compiler is allowed to replace -NaN(17) by NaN(17) in the code.
OK - you obviously know vastly more than I about this - if the Standard says this, (unhelpful or not) then it would be a bad idea to try to use the sign bit to carry any information. But this still me leaves wondering about the original (very common) use case - you have a 'database' (and you want to be able to serialize - and back (of course, at least for systems using the same FP layout for floats and doubles). Without loopback it's difficult to validate its contents. It would be extremely useful to be able to distiguish between values that never existed - 'missing values' and those that some computation results in a NaN. Can you suggest how to achieve a 'missing value'? Surely we can do better than 'Enter 999999.9 to end input' - using a single FP bit pattern for 'missing value'? Do we have to accept storing a bool with each value - and take a serious hit in 'database' size and the cost of its transfer? Do we use other bit(s) in the NaN payload? Paul --- Paul A Bristow Prizet Farmhouse, Kendal, Cumbria UK LA8 8AB +44 1539561830 & SMS, Mobile +44 7714 330204 & SMS pbristow@hetp.u-net.com