Question about 0n

q)max 0n

0n

q)max 0n 0n 0n

-0w

Why the max of three 0ns is -0w?

version: kdb+ 3.1

(I can’t find my previous topic so I start a new one.)

http://code.kx.com/wiki/Reference/max

q)max 0N 0N                        / negative infinity if all null
-0W
q)min 0N 0N                        / infinity if all null
0W

It is the neutral element of min/max
Also see
q)minint$() 0W q)maxint$()
-0W

Similarly 0 is for sum and 1 for prd

Min/max on an atom x is a special case to leave x untouched

Cheers,
  Attila

Thank you all,

  1. if it is an atom, return unchanged. (got it!)

  2. else if all 0n, return -0w

  3. else ignore 0n

While we’re on the topic, what does 0N! do? i’ve seen it used in multiple situations

http://code.kx.com/wiki/Reference/BangSymbol

0N!x

With a 0N on the left hand side, returns the right hand side after printing its unformatted text representation to console. This is useful for debugging, or avoiding formatting which may obscure the data’s structure.

q)2+0N!335