
Steven Watanabe writes:
AMDG
Dave Steffen <dgsteffen <at> numerica.us> writes:
a) It might be handy, though, to have (for example) a log function that enforces unitless quantities. For example,
log ( velocity * time / meters )
is fine, but if you forget to multiply by the time, you get a helpful error message.
b) It might also be handy, if possible, to have some functions that take units and know what to do; for example, sqrt (m*m) properly returns meters, and so forth.
Absolutely.
We already have sin/cos &c.
We don't have sqrt but root<2>(m * m) will give give the correct answer (albeit inefficiently). I'll look through cmath and add all the applicable functions.
Cool. Our application could / should be using this sort of thing, but there are some significant difficulties involved. So we won't be using units any time soon, but at some point we'll have to tackle these issues. ---------------------------------------------------------------------- Dave Steffen, Ph.D. Fools ignore complexity. Software Engineer IV Pragmatists suffer it. Numerica Corporation Some can avoid it. ph (970) 461-2000 x227 Geniuses remove it. dgsteffen@numerica.us -- Alan Perlis