Next: Function Calls, Previous: Boolean Operations, Up: Expressions [Contents][Index]
The unary negation operand is always converted to integer type:
-(1 + 1) ⇒ -2
-(127.0.0.1 + 2) ⇒ -2130706435
- ("1" + "1") ⇒ -11
- "text" error→ cannot convert string to integer
The unary not operand is converted using the following rules:
integer, no conversion is performed.
STRNUM (see STRNUM) or
ipaddr, it is converted to integer.
string (but is not STRNUM), the
result of not is true only if the operand is an empty
string.
avl, the result of not is
true if the list is empty.
Examples:
not 0 ⇒ 1 not 10 ⇒ 0 not "23" ⇒ 0 not "0" ⇒ 1 not "text" ⇒ 0 not "" ⇒ 1 not 127.0.0.1 ⇒ 0 not 0.0.0.0 ⇒ 1
When operands of two different data types are used in a binary operation, one of the operands is converted (cast) to another operand’s type according to the following rules:
radtest attempts
to convert another operand to the literal data type. If this attempt
fails, it goes on to rule 2.
STRNUM (see STRNUM) and another is of numeric
data type (i.e. either integer or ipaddr), the latter is converted
to string representation.
ipaddr and another is
integer, the latter is converted to ipaddr.
Radtest
prints appropriate diagnostics and aborts execution of the current
statement.
Next: Function Calls, Previous: Boolean Operations, Up: Expressions [Contents][Index]