Operators in Logical and Arithmetic Expressions

(These operators have the same syntax and behavior as in C. The FORTRAN-style operators (.lt., .or., etc.) that were allowed in DSL version 3.1 are no longer supported in BTCL version 95.0.)


-a
negative of a
!a
logical NOT: evaluates to 1 if a is zero, 0 otherwise
~a
bit-wise complement
a+b
add a to b
a-b
subtract b from a
a*b
multiply a by b
a/b
divide a by b
a%b
remainder after dividing a by b
a&b
bit-wise AND of a and b
a|b
bit-wise OR of a and b
a^b
bit-wise exclusive OR of a and b
a==b
evaluates to 1 if a is equal to b, 0 otherwise
a!=b
evaluates to 1 if a is not equal to b, 0 otherwise
a<=b
evaluates to 1 if a is less than or equal to b, 0 otherwise
a>=b
evaluates to 1 if a is greater than or equal to b, 0 otherwise
a<b
evaluates to 1 if a is less than b, 0 otherwise
a>b
evaluates to 1 if a is greater then b, 0 otherwise
a&&b
logical AND: evaluates to 1 if a and b are nonzero, 0 otherwise
a||b
logical OR: evaluates to 1 if a or b are nonzero, 0 otherwise
a?b:c
choice: if a is nonzero then b, else c

Main access page Advanced-Use access.

BTCL Language access The eval and expr Commands Mathematical Functions

Copyright Biosym/MSI