- #1

- 139

- 0

Hi everybody,

I would like to know your opinion about this:

The (-) minus sign is used to represent both negative numbers and subtraction. Of course, subtraction is a special case of addition, but we definitely use this operation instead of always writing a+(-b) for example. So my question is, when we write -a-b we mean this: (-a)-b? I mean, the first minus is to indicate a negative number while the second subtraction? Also, have we set any precedence between these 2 different uses of the minus sign? I know that we say that we do subtractions from left to right but a small "problem" arises when the first term of an expression is negative. When we have for example -1+2a+3-4(z^2) ... all minus signs can be thought of as subtraction except from the first one. Is it clear that it is "part" of the first number,in other words a unary operator, and not a binary operator? I guess we could solve that "problem" by saying that we mean this: 0-1+.... But I am not sure which is the most sensible explanation.

And one more thing: is it because of the definition of subtraction that we say it has the same precedence as addition? And when we write a-b+2c+5 for example, is it because of this same precedence that this expression is equal to a+(-b)+2c+5 and not to a+[-(b+2c+5)]?

That's all. Sorry if all these sound stupid to u.

Thanks

I would like to know your opinion about this:

The (-) minus sign is used to represent both negative numbers and subtraction. Of course, subtraction is a special case of addition, but we definitely use this operation instead of always writing a+(-b) for example. So my question is, when we write -a-b we mean this: (-a)-b? I mean, the first minus is to indicate a negative number while the second subtraction? Also, have we set any precedence between these 2 different uses of the minus sign? I know that we say that we do subtractions from left to right but a small "problem" arises when the first term of an expression is negative. When we have for example -1+2a+3-4(z^2) ... all minus signs can be thought of as subtraction except from the first one. Is it clear that it is "part" of the first number,in other words a unary operator, and not a binary operator? I guess we could solve that "problem" by saying that we mean this: 0-1+.... But I am not sure which is the most sensible explanation.

And one more thing: is it because of the definition of subtraction that we say it has the same precedence as addition? And when we write a-b+2c+5 for example, is it because of this same precedence that this expression is equal to a+(-b)+2c+5 and not to a+[-(b+2c+5)]?

That's all. Sorry if all these sound stupid to u.

Thanks

Last edited: