# "Strong typing vs. strong testing"

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Wed Oct 13 15:19:02 CEST 2010

```Hmmm, my ISP's news software really doesn't like it when I cross-post to
more than three newsgroups. So, trying again without comp.lang.c.

On Wed, 13 Oct 2010 02:00:46 +0100, BartC wrote:

> "RG" <rNOSPAMon at flownet.com> wrote in message
> news:rNOSPAMon-20651E.17410012102010 at news.albasani.net...
>> In article <i92dvd\$ada\$1 at news.eternal-september.org>, "BartC"
>> <bc at freeuk.com> wrote:
>>
>>> "Thomas A. Russ" <tar at sevak.isi.edu> wrote in message
>
>>> > But radians are dimensionless.
>>>
>>> But they are still units
>>
>> No, they aren't.
>>
>>> so that you can choose to use radians, degrees or gradians
>>
>> Those aren't units either, any more than a percentage is a unit.  They
>> are just different ways of writing numbers.
>>
>> All of the following are the same number written in different
>> notations:
>>
>> 0.5
>> 1/2
>> 50%
>>
>> Likewise, all of the following are the same number written in different
>> notations:
>>
>> pi/2
>> 90 degrees
>> 1/4 circle
>> 0.25 circle
>> 25% of a circle
>> 25% of 2pi
>>
>> See?
>
> But what exactly *is* this number? Is it 0.25, 1.57 or 90?

That's the wrong question. It's like asking, what exactly "is" the number
twenty-one -- is it "one and twenty", or 21, or 0x15, or 0o25, or 21.0, or
20.999... recurring, or 63/3, or XXI, or 0b10101, or "vinet et un", or any
one of many other representations.

Whether you say "two tens plus one unit" or "two to the power of four plus
two to the power of two plus two to the power of zero", the number is the
same number. So long as you use a consistent notation, the results you get
is independent of the notation. (Of course, some notations are more
convenient than others.)

Likewise, it doesn't matter whether you write 45° or π/4 radians, the
angle you are describing -- the number -- is the same. It turns out that
trigonometric functions have very nice (= important, useful) mathematical
properties if the notation we use for angles is the radian measure, where
2π radians make a full circle. This leads some people to mistakenly say
that radians are more fundamental than degrees, or that they are the
"actual" value for the angle.

But that's like saying that binary is the "actual" base for numbers
because addition and subtraction in binary have the nice property that
they're easy to implement in electrical circuits. Well, yes, and those
properties are very important, and mathematicians have done the sensible
thing to declare radians to be "the" mathematical measure of angles, but
triangles will still be triangles regardless of whether we represent the
angles using base ten radians or balanced ternary rational fractions. No
matter what language we use to represent a number, the properties of the
number remain the same. Or to put it another way, a rose by any other
name would smell just the same.

--
Steven

```