|
Boost : |
From: Daryle Walker (dwalker07_at_[hidden])
Date: 2003-08-18 01:05:01
On Sunday, August 17, 2003, at 10:33 PM, Paul A. Bristow wrote:
[SNIP]
> But you are right that it would be better to check that
> numeric_limits::digits exists and isn't something silly before using
> the formula. With all the built-in floating point types it should be
> fine, and for other (well) User defined floating point types too. (I
> will look at this).
[TRUNCATE]
I think you need to check numeric_limits::radix since your algorithm
had a base-2-to-10 conversion (the type may not actually be binary!).
The algorithm was based off a paper about IEEE-754; if IEEE-754 is a
requirement, you may have to check for that too (via
numeric_limits::is_iec559). Remember that even the built-in
floating-point types aren't guaranteed to match IEEE-754!
Daryle
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk