"Strong typing vs. strong testing"

Pascal J. Bourguignon pjb at informatimago.com
Wed Oct 13 05:46:43 CEST 2010

Tim Bradshaw <tfb at tfeb.org> writes:

> On 2010-10-12 20:46:26 +0100, BartC said:
>> You can't do all that if angles are just numbers.
> I think that the discussion of percentages is relevant here: angles
> //are// just numbers, but you're choosing a particular way of
> displaying them (or reading them). 100% //is// 1, and 360° //is// 2π.
> So really, like, for instance, number base, they're things that exist
> for I/O but not inside the system.  At least for the purposes of doing
> maths: computer type systems often don't have very much to do with
> maths (for instance floating-point numbers are obviously a very
> important type, but don't map onto anything that would be interesting
> to a theoratical physicist).

Units are really the product of two things: a dimension, and a scale.

You can add values that have the same dimension, even if they don't have
the same unit (this doesn't necessarily make the addition meaningful,
because having the same dimension still doesn't mean they've got the
same semantics, but that's another question).

So for example, you can add meters and inches.  Both have the dimension
of length.  But meters have the scale of 1/299792458 while inches have
the scale of 254/2997924580000.  Scales are not absolute, they're given
in relation to some other scale, so you could also say that:
1 inch = 0.0254 meter, or that the scale of inches with respect to
meters is 10000/254.

So the interesting thing is that some pseudo-units don't have
dimensions.  They only have the scale.  Radian and Degrees have no
dimension, but they still have scale, with 1 degree = Π/180 radian.

I would argue that angles are not just numbers.  There's a notion of
angle that is different from the notion of interest rate.  (I have also
vague memories of a mathematical presentation of angles that clearly
distinguished angles from numbers used to represent them).

__Pascal Bourguignon__                     http://www.informatimago.com/

More information about the Python-list mailing list