|
Boost : |
From: Jeff Garland (jeff_at_[hidden])
Date: 2003-09-04 07:40:56
On Wed, 03 Sep 2003 15:10:13 -0400, David Abrahams wrote
> "Jeff Garland" <jeff_at_[hidden]> writes:
>
> >>Jeff G wrote:
> >> I'm thinking it would have to be defined like this
> >> Duration / Duration --> Integer
> >>
> >>I think Duration / Duration --> double would be more appropriate.
> >
> > I have intentionally avoided floating point types in the library
> > because there is no reason to suffer the loss of correctness
> > associated with these types.
>
> Huh?
>
> 3/2 == 1
>
> is correct?
Yes. Of course to make this useful you will need % as well.
> You get a much bigger round-off error from ints than from floats.
Yes, but you know what you are getting up front. With floats you don't know
until runtime what the round-off will be. Anyway, I have yet to here a
compelling use case in this domain for using non-integer arithmetic.
Jeff
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk