[boost] Re: Physical Quantities revisited
by Andy Little other posts by this author
Oct 23 2003 2:38PM messages near this date
[boost] Re: Physical Quantities revisited
|
Re: [boost] Re: Physical Quantities revisited
"Ross MacGregor" <ross__macgregor@[...].com> wrote in message
news:bn89jt$1ta$1@[...]..
> 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
2.9979245e8 ?
(I would argue on 1)
But basically Yup! :-)
regards
Andy little
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Thread:
Andy Little
Andy Little
Andy Little
Andy Little
Andy Little
Andy Little
Andy Little
Jan Langer
Andy Little
Deane Yang
Paul A. Bristow
Phil Richards
Rene Jager
Deane Yang
Phil Richards
Andy Little
Deane Yang
Brock Peabody
Paul A. Bristow
Andy Little
Andy Little
Matthias Troyer
Paul A. Bristow
Ross MacGregor
Deane Yang
Paul A. Bristow
Deane Yang
Paul A. Bristow
Paul A. Bristow
David Abrahams
Jonathan de Halleux
Philip Miller
Deane Yang
Paul A. Bristow
Paul A. Bristow
David Abrahams
|