|
Boost : |
From: Paul A Bristow (pbristow_at_[hidden])
Date: 2006-03-17 06:18:53
Ooops - this is a typo.
It should of course be 3010/10000.
(All this is because floating point calculations, especially log10(2) =
0.3010.... can't be done at compile time - a shame because it could be - and
has received some consideration for the next C++0x).
Sorry.
Paul
| -----Original Message-----
| From: boost-bounces_at_[hidden]
| [mailto:boost-bounces_at_[hidden]] On Behalf Of Peter Broadwell
| Sent: 15 March 2006 20:43
| To: boost_at_[hidden]
| Subject: Re: [boost] [serialization]
| Serialisation/deserialisation offloating-point values
|
| Note the difference between the "definition" formulae of 3010/10000
| and the suggested formulae using 3030/10000.
|
| Perhaps this is on purpose, if not may explain why the tests done
| later in this thread wich use the 3030/10000 version had troubles?
|
| ;;peter
|
|
| Paul A Bristow wrote:
| > [...]
| > For C++, using numeric limits,
| >
| > So it is convenient instead to use the following formula
| which can be
| > calculated at compile time:
| > 2 + std::numeric_limits<double>::digits * 3010/10000;
| >
| > [...]
| > and I suggest that this should be:
| >
| > os << std::setprecision(2 + std::numeric_limits<double>::digits *
| > 3030/10000);
| >
| > HTH
| >
| > Paul
| >
| >
| >
| _______________________________________________
| Unsubscribe & other changes:
| http://lists.boost.org/mailman/listinfo.cgi/boost
|
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk