Last edit
Summary: wiki syntax fixes
Changed:
< value /= 3 # value = value / 3
to
> value /= 3 # value = value / 3
Changed:
< # This will cause a fatal error in traditional awk implementations
< BEGIN {
< print 3 / 0 # inf
< }
to
> # This will cause a fatal error in traditional awk implementations
> BEGIN {
> print 3 / 0 # inf
> }
The slash symbol can be used as the division operator to produce the result of a quotient division calculation of two [[operand?]]s:
answer = 18 / 3 # 6
The division [[combination_assignment_operator?]] represented by a [[climbequal?]]s digraph, can also be used to perform a quotient division calculation:
value /= 3 # value = value / 3
The awk programming language does not support the use of a backslash symbol as an integer division operator. However, the [[int?]] function can be used to produce [[integer?]] results from a mathematical quotient:
BEGIN { print int(22 / 6) }
Traditional Unix behaviour is to abort awk with a fatal error, if a division by zero is encountered.
The mawk interpreter does not abort with a fatal error if a division by zero is encountered. Instead mawk returns an inf string without producing a warning or error: