You sir, are one of the treasures of Google. I miss you.

 
From: "Thomas Bushnell, BSG" <tbushn...@google.com>
Date: Friday, August 19, 2016 at 5:28 PM
To: Michael Jones <michael.jo...@gmail.com>, Axel Wagner 
<axel.wagner...@googlemail.com>, Rob Thornton <rthornton...@gmail.com>
Cc: golang-nuts <golang-nuts@googlegroups.com>
Subject: Re: [go-nuts] Unary +

 

With all due respected to the illustrious Dr. Iverson, he was in loony-land 
with his two versions of minus.

 

The notation "-3" does not mean "negative three", which, as my freshman math 
professor, a lover of English, pointed out, is a solecism, since "negative" is 
an adjective, and three is and always will be a positive number. There is no 
negative version of three, there is simply three, a positive number, and its 
opposite, a negative number, which is firmly not three, and not a species or 
kind of three.

 

The name for the opposite of three in English, properly, is of course, "minus 
three" - simply the reading of the signs by which we indicate the number.

 

Now for three and its opposite, this is not a terribly important point. But my 
professor would insist on it because with other notations, it does matter.

 

For when we speak of the square root of four, we are naming two different 
numbers at once ambiguously, and we can speak of the positive square root of 
four (two) and the negative square root of four (minus two). For the negative 
square root of four is not "the opposite of the square root of four", which is 
just as ambiguous as saying "the square root of four". (The opposite of the 
negative square root of four is, of course, the firmly positive two.)

 

The systematic ambiguity which Iverson was on to is not about numbers like 
three at all; there is no sense in which the minus sign in "-3" is any 
different from the one in "-x". The former is not "part of the numeral"; it's a 
way of indicating the opposite of three, just as -x indicates the opposite of x.

 

But when we need to distinguish the two meanings of √4, we do find signs 
useful, and we can write -√4 and +√4 in order to clarify whether we mean the 
positive or the negative square root of four. And this indeed can matter when 
the expression under the radical is more complex. It really matters when we are 
concerned with √-1, for which the two values are neither positive nor negative, 
and so we cannot properly say +√-1 or -√-1, even though we certainly can say -i 
and i. (And the key then is the systematic symmetry of the complex numbers, in 
which any theorem that can be proved about the complex numbers can be proved 
for their conjugates as well, which is certainly not true for 2 and -2!)

 

Now, whether minus three is a single idea or two, I submit that counting ideas 
is a thing that leads only to madness. "As I was going up the stair, I met a 
man who wasn't there. He wasn't there again today; I wish, I wish, he'd go 
away!" When there is a book on the table, is there one thing or many? What is a 
"composite idea" and which ideas are "simple"? (And how our ancestors would be 
horrified to hear someone say that minus three is a simple idea!)

 

So it would be nice to have one symbol in the case of -√4, and a different one 
for both -2 and -x. For the case of i and -i the case is even weirder, for our 
theorems don't depend on the difference at all, as long as we have a difference.

 

Now if you're still reading, and you say, "but Thomas, -2 is negative, but for 
-x it might be or it might not be!" Yes, certainly, but this is because two is 
positive and x is unspecified. The difference is the difference between "2" and 
"x", between a determinate quantity and an indeterminate one, and not anything 
to do with what "-" means: in both cases it means "the opposite of".

 

You might think that in the case of -2 the sign is asserting that the number is 
negative, and that this is a useful thing. Well, this is exactly what is going 
on with -√4: but not in the way of asserting that √4 is negative, but rather of 
choosing from two values the one which is negative. -2 is doing nothing of the 
kind; it is not as though 2 indicated two different things ambiguously.

 

Yours, pedantically.

Thomas

 

 

On Fri, Aug 19, 2016 at 4:00 PM Michael Jones <michael.jo...@gmail.com> wrote:

My answer is philosophical, and possibly not what is wanted, but it is 
informed. Here goes:

 

Backstory: Unary Minus, as taught in computer science and implemented in 
languages and instruction sets and so forth is slightly confusing and often 
confusingly described.

 

x := -y // means get the value of y, negate that, and assign to the location 
known as x.

 

This is what we commonly think of when seeing unary minus. It is proper. 
However this…

 

x := -3 // does NOT mean get the value 3, negate that, and assign to the 
location known as x.

 

…instead it means “assign the value ⁻3 to x”, where negative 3 is a single 
idea, not two as in (Negate 3). The raised minus sign is from Kenneth Iverson, 
who used it in APL to make the point that the ‘⁻’ and ‘-‘ have entirely 
different meanings.

 

There is a Wikipedia article about this but its scholarship is, well, more 
about usage than history. They talk about the raised minus as an elementary 
school teaching tool (which it may be) but they leave it there with little 
suggestion of its illustrious past. Yet, to their credit there is a handy 
example:

 

⁺3 − ⁻5 becomes ⁺3 + ⁺5 = ⁺8

 

where you might imagine a teacher saying “positive three minus negative five 
becomes…” which is nice. (A sophisticated college CS teacher or parser coder 
might instead say “plus 3 minus minus 5 becomes…” ;-) We don’t have the raised 
minus to say “here is a negative number” so we make use of the unary rather 
than binary minus to suggest negative. You use what you have. 

 

Now, on to the original question: 

 

Standard floating point output since the 1950’s has allowed printing of either 
blank or “+” as the prefix for positive floating point values and, necessarily, 
the lowered minus “-“ for negative values; we get the ‘+’ with a printf format 
like “%+10.4f”. 

 

It is handy to be able to parse what is output, such as numerical 
approximations and weights in formula source code, so the parsing of “3.1415” 
was made to accept “+3.1415” for the same meaning, and of course “-3.1415” 
since we lack the raised minus.

 

Since floating point values accept the stylistic ‘+’ prefix, so do integer 
values.

 

..and here we are today, some 50 years later.

 

P.S. If you visited Thomas Payne’s bookshop in London (in the 1750s) you could 
have bought your own copy of Francis Maseres’ “A dissertation on the use of the 
negative sign in algebra: containing a demonstration of the rules usually given 
concerning it; and shewing how quadratic and cubic equations may be explained, 
without the consideration of negative roots. To which is added, as an appendix, 
Mr. Machin's quadrature of the circle.” You could have enjoyed much discussion 
of the new style of writing and its advantages.

 

 

From: "'Thomas Bushnell, BSG' via golang-nuts" <golang-nuts@googlegroups.com>
Reply-To: "Thomas Bushnell, BSG" <tbushn...@google.com>
Date: Friday, August 19, 2016 at 1:36 PM
To: Axel Wagner <axel.wagner...@googlemail.com>, Rob Thornton 
<rthornton...@gmail.com>
Cc: golang-nuts <golang-nuts@googlegroups.com>
Subject: Re: [go-nuts] Unary +

 

In C, the type is promoted. But this ain't C. No clue what the point is in Go. 
It would function as a compile-time type-check for "numeric" I guess, but what 
would be the point?

 

 

On Fri, Aug 19, 2016 at 1:32 PM 'Axel Wagner' via golang-nuts 
<golang-nuts@googlegroups.com> wrote:

x would already be signed during implicit type inference. The inferred type is 
either the one specified in an argument or declaration, or it's the default 
type (which is int, thus signed).

 

I don't know the answer to your question though. I didn't even know this 
existed…

 

On Fri, Aug 19, 2016 at 9:54 PM, Rob Thornton <rthornton...@gmail.com> wrote:

What is the purpose of the unary '+' operator? In both C and Go they are 
syntactically correct but neither generate instructions to modify the 
expression.

The '-' operator obviously generates a neg or sub from 0 instruction to negate 
the result by inverting the expression with an add with carry.

I know of no single instruction or pair of instructions to reliably ensure any 
value or expression is always positive so why include this unary operator at 
all? Is there a purpose I'm missing? Or is it just for clarity or force an 
implicit variable to be signed?

As in:

x := +5

Would this ensure that x must be signed during impicit type inference?

If I read the specification correctly, this would also affect the resolution of 
untyped constants. Is this correct?

--
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

 

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to