Skip to content

neg

Negate

Syntax: neg x, neg[x]

Returns the negation of boolean or numeric x. A null has no sign, so is its own negation.

q)neg -1 0 1 2
1 0 -1 -2

q)neg 01001b
0 -1 0 0 -1i

q)neg (0W;-0w;0N)               / infinities and a null
-0W
0w
0N

q)neg 2000.01.01 2012.01.01     / negates the underlying data value
2000.01.01 1988.01.01

An atomic function.

Domain and range

domain b g x h i j e f c s p m d z n u v t
range  i . i h i j e f i . p m d z n u v t

Range: ihjefpmdznuvt

not, Subtract
Mathematics
Q for Mortals §4.3.2 Not Zero not, §4.9.2 Temporal Arithmetic