|
Boost : |
From: Johan Råde (rade_at_[hidden])
Date: 2006-08-14 11:18:49
New version uploaded to the vault, with
1. More documentation
2. Documentation in HTML format
3. Regression tests written with the Boost.Test library
Where should the code live, if accepted into Boost?
The serialization library is not the right home.
I would suggest the boost.math library.
This is a already a collection of unrelated sub-libraries, such as
quaternion, special functions and greatest common divisor.
--Johan Råde
Johan Råde wrote:
> ----- The Problem -----
>
> The C++98 standard does not specify how non-finite floating point
> numbers,
> such as infinity and not-a-number, should be represented in text streams.
> As a result, different platforms use different representations.
> This can cause undefined behavior when text files and serialization
> archives
> are moved between different platforms.
>
> Some platforms can not even read their own output!
> For instance, the following test fails with VC++ 7.1:
>
> stringstream s;
> double x = numeric_limits<double>::infinity();
> double y;
> ss << x;
> ss >> y;
> assert(x == y);
>
>
> ----- The Solution -----
>
> The facets extended_num_put and extended_num_get
> write and read non-finite floating point numbers
> to text streams in a consistent and portable manner.
>
> The following test succeeds with VC++ 7.1:
>
> stringstream s;
> locale old_locale;
> locale tmp_locale(old_locale, new extended_num_put<char>);
> locale new_locale(tmp_locale, new extended_num_get<char>);
> s.imbue(new_locale);
>
> double x = numeric_limits<double>::infinity();
> double y;
> ss << x;
> ss >> y;
> assert(x == y);
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk