Math Commands

 

 

 

Operator

 

Description

 

 

 

 

 

 

^

 

xor

 

 

 

+, blank(s), -

 

addition, implied addition, subtraction

 

 

 

*, /, %

 

multiplication, division, remainder

 

 

 

**

 

power

 

 

 

Hexadecimal numbers are prefixed with the characters 0x or just x. Octal numbers are prefixed with the character O or digit 0.

Note

Not all Slick-C language operators are supported.

Math Command Examples

The following table shows some examples of math commands:

Table 8.2. Math Command Examples

Example

Description

 

 

math 2.5*2

Multiplies 2.5 times 2

 

 

math 5/2

Divides 5 by 2

mathx 255

Converts 255 to hexadecimal

 

 

math xFF

Converts hexadecimal FF to decimal

 

 

math o77

Converts octal 77 to decimal

 

 

matho 255

Converts 255 to octal

 

 

math 077+0xff+10

Adds octal 77, hex FF, and 10

 

 

Overflow/Underflow

If overflow or underflow occurs, the message Numeric overflow or underflow is displayed on the message line. Floating point numbers may have up to a 32-digit mantissa and a 9-digit exponent.

325

Page 347
Image 347
Slick V3.3 manual Math Command Examples, Overflow/Underflow