From: Andy Little (andy_at_[hidden])
Date: 2003-10-23 09:38:40
"Ross MacGregor" <ross__macgregor_at_[hidden]> wrote in message
> For example if you want your basic unit of length to be 299,792,458
> meters and you wanted your calculations to use floats. You may want to
> specify it like this:
> si_unit<float, 2.99792458e+8, meter_t> light_meters;
Slight problem on the Float here !
How does it work with (say) force?
> si_unit<long double, 1.0, meter_t> meters;
> light_meters x_lm = 2500;
Assume this means 2500 light_meters rather than 2500 meters .?
> light_meters y_lm = 10;
> light_meters z_lm = x_lm + y_lm;
> meters m = lm; // warning possible loss of precision
> We are essentially creating a custom floating point value, but only
> incurring the overhead during unit conversion.
Critical issue is whether the internal value of light_meters is 1 or
(I would argue on 1)
But basically Yup! :-)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk