|
Boost Users : |
Subject: Re: [Boost-users] [math] round to fraction
From: Scott McMurray (me22.ca+boost_at_[hidden])
Date: 2010-10-26 13:27:09
On Tue, Oct 26, 2010 at 10:01, John Maddock <boost.regex_at_[hidden]> wrote:
>
> Of course this assumes that parameter "f" is exactly representable as a
> floating point value, in fact it might need to be a power of 2 in order to
> be certain of being completely safe and accurate....
>
"Safe and accurate" is always far beyond my ability to prove when it
comes to floating point. Even if f is a power of two, what is
something like round2fraction(sqrt(1e41), 4) supposed to do?
Perhaps the best it can promise is something like "when the result is
displayed with digits10-1 significant figures, it will appear to have
been rounded as requested".
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net