|
Boost : |
From: Dan W. (danw_at_[hidden])
Date: 2003-12-11 02:11:31
First I would like to apologize for having started this debate over radians
and degrees, I did so deliberately, and now I half-regret it. My sneaky
intention was to sneak-in a math sub-layer under the units library. I only
half-regret it because I do feel it needs considering, if not
addressing; but I do half-regret it because I should have just said so,
rather than inject a philosophical monkey-wrench.
In math there are dimension-less units routinely. The base of imaginary
numbers, as well as the bases of hyperimaginary numbers, for instance. 1
and 1j are both dimension-less, and yet they are distinct 'units'. In a
financial application, taking an even root of a negative number may be
meaningles, yet in a physics context it may be meaningful. Same goes for
logarithms of negative numbers. Same goes for factorials of real numbers.
Taking the derivative of order 2.666.. of a function may mean nothing in
one context, but fractional differintegration, as it is called, has its
applications.
If we were to ask the units library to deal with all these issues, we might
as well kill it. It can't, and it's outside the scope of what it was meant
to deliver, namely to make sure I don't add seconds to millimeters, and
assign the result to inches. If this library can simply do this, it will
revolutionize programming.
If we ask of it that it ensures that proper numbers be fed to inverse trig
functions, there will be no end to the growth in requirements. Degrees and
Radians are in the scope of math, not of physical units, and if the units
library offers a Degrees type, it should do so "For Entertainment Purposes
Only", IMO. There needs to be a comprehensive tackling of math issues,
eventually, but that should be the job of a math layer, between the
hardware-abstraction-numerical layer, and the physical units layer.
Re.: Degrees/Radians: I agree with Matthias Schabel philosophically, and
with Walter Landry in practical terms: Philosophically, both Radians and
Degrees are *units* of angle, and both are equally dimension-less. One is
more "natural" than the other, but this esthetic difference in no way
amounts to a semantic distinction. In practise, however, I think that
Walter is quite right not wanting Radians to be a formal unit, for, even if
we stress the dimension-less-ness of Radians, if they are anything at all,
in programming terms, the are a type. If they are a type, but they need to
be assignable from AND assignable to non-Radian dimension-less numbers,
we'll just get redundant conversion errors, and their existance is
meaningless. Thus, in practical terms, I'd say that only Degrees should be
a unit, if any angle units were provided at all; and whose only
raison-detre would be to multiply themselves by pi/180, return a float and
die. I wouldn't even give them participation in a units system at all, and
I'd probably program them in assembler as symbolic of their type being a
temporary hack to get rid of ASAP ;-)
Cheers!
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk