Elmo HARSFEN0602, HARmonica Command line, Expressions And Operators, Numbers, Example

Models: HARmonica HARSFEN0602

1 220
Download 220 pages 51.63 Kb
Page 21
Image 21

HARSFEN0602ElmoHARmonicaSoftwareManual

PRELIMINARYDRAFT

4.1The command line

The Interpreter evaluates input strings, called “expressions”. An expression is a sequence of characters, terminated by semicolon ‘;’, a line feed, or a carriage return.

command line may include the “Comment marker” – two consecutive asterisks. All the text from the comment marker to the next line feed or carriage return is ignored.

The maximal expression length is 512 symbols.

The comment marker feature enables the preparation of documented batch files, to be later sent directly to the amplifier.

Example:

a = 3 ; b = 2 ; c = a + b ** Ignore this text

This line consists of three expressions separated with semicolon. The comment “Ignore this text” is ignored.

4.2Expressions And Operators

The Amplifier language supports operators, which specify a mathematical, logical or conditional operation/relation between two operands or more. Operands (actually parameters) and operators may be combined in almost any way to create an expression. The following paragraphs present the operators and the expression syntax rules.

4.2.1Numbers

The Amplifier has two number types: 32 bit integers and 32 bit floating point numbers. As text inputs, numbers that contain a decimal point or an exponent notation are interpreted as floats. Other numbers are interpreted as integers.

The range for integers is [-2.1475e+009,+ 2.1475e+009].

Positive integers may be written as decimal or as hexadecimal.

The hexadecimal notation 0x10 is equivalent to the decimal number 16.

A 32-bit floating-point number has 24 significant mantissa bits and 8 bits of exponent. The range for floating point numbers is [-1e20, 1e20].

A floating-point number may be written with or without an exponent.

2.5e4 is equivalent to 25000.0. It is not equivalent to 25000, since the latter number is interpreted as integer.

If an integer number overflows integer range, it is interpreted as an error.

If a floating-point number overflows floating-point range, it is interpreted as an error.

Logical operators yield 0 or 1 as a result. The results of logical operators are integers.

4.2.2Mathematical And Logical Operators

The following table lists the mathematical and logical operators of the language. The table also specifies the operator precedence, which is discussed in the next paragraphs. The larger number has the higher precedence.

Operator

Description

Precedence

 

 

 

19

Page 21
Image 21
Elmo HARSFEN0602, HARmonica Command line, Expressions And Operators, Numbers, Mathematical And Logical Operators, Example