|
Ublas : |
From: Jeffrey Brent McBeth (mcbeth_at_[hidden])
Date: 2007-08-24 07:53:10
On Fri, Aug 24, 2007 at 01:22:54PM +0200, Karl Meerbergen wrote:
> Hi,
>
> What is the advantage of boost::rational numbers compared to floating
> numbers?
Err, if you are only working with rational numbers, then you can get exact
answers, where with floating point, you only get exact answers for
non-repeating short mantissa decimal representations. For example .03 can
be represented as 3/100 rather than .02999.. (doesn't go on forever, but I
don't remember the cut off for fp right now)
Jeff
-- ---------------------------------------------------------------------------- "The man who does not read good books has no advantage over the man who cannot read them." -- Mark Twain ----------------------------------------------------------------------------