- y (Negate)

Back to: Vocabulary

Negates value of number y

   - 0 1 2.2 3j4 4r5 _66
0 _1 _2.2 _3j_4 _0.8 66

Common uses

Inverting the sign of a number.

Limitations

Only works with numbers.

   - !55x          NB. Negate factorial 55 (extended integer)
_12696403353658275925965100847566516959580321051449436762275840000000000000
   - 1j1 3r4 2p1   NB. Negate complex, rational, two pi
_1j_1 _0.75 _6.28319

   -'hi'           NB. But not characters
|domain error
|       -'hi'
   -<2             NB. or enclosed.
|domain error
|       -<2

Animation Illustrating Negate (-)

Embedded application/x-shockwave-flash

See Also


x - y (Minus)

Back to: Vocabulary

Subtracts the value of y from x

   0 1 2.2 3j4 4r5 66 - 2 
_2 _1 0.2 1j4 _1.2 64

The verb Minus (-) differs from the noun decorator Negative Sign (_) . The following subtracts the two-element vector 5 7 from the two-element vector 2 3 , returning a pair of negative values:

   2 3 -5 7
_3 _4

Common uses

Subtraction per the rules of arithmetic.

   _9 _1 0 1 5 10 - _4 4 99 1 2 3
_5 _5 _99 0 3 7

Example with complex numbers: XjY - ZjW is (X-Z)j(Y-W) .

   5j5 1j1 1j1 _2j3 _4j_5 - 1j1 1 0j1 0j2 _10j_10
4j4 0j1 1 _2j1 6j5

Limitations

Subtraction involving infinity and a non-infinite quantity work as expected:

   _ - 3    NB. Infinity minus three is infinity
_
   3 - _    NB. Three minus infinity is negative infinity
__

But infinity minus infinity is undefined:

   _ - _
|NaN error
|   _    -_

Animation Illustrating Minus (-)

Embedded application/x-shockwave-flash

See Also


CategoryVoc

Vocabulary/minus (last edited 2011-06-06 20:03:19 by IanClark)