& (Real)

Rax real type is denoted by the & symbol. Rax stores real numbers as 64-bit floating point numbers. As you probably know, only a finite number of the real numbers can be represented exactly in the floating point format. Therefore, in languages such as C, comparing two floating point values can yield unexpected results. To alleviate this problem, Rax has a concept of epsilon. Real values, whose absolute difference is smaller that the epsilon are considered equal by Rax. The default value of epsilon is 1e-6 or 0.000001. You can change the value of epsilon by using the %epsilon meta instruction. For example, to change epsilon to 1e-10, use:

    %epsilon 1.0e-10;
         

The following operators are defined on the & type:

Table 3.3. Operators defined on &

Operator nameSyntaxExplanation
Arithmetic operators
Assignment a := b  
Addition a + b  
Subtraction a - b  
Unary plus +a  
Unary minus -a  
Magnitude value #a  
Unary ceiling :/a Returns the smaller integer greater or equal to a.
Unary floor :\a Returns the greatest integer smaller or equal to a.
Multiplication a * b  
Division a / b  
Modulo a % b  
Power a ** b  
Binary floor a :\ b Returns the smallest multiple of b greater than or equal to a. For example: 7 :\ 3 == 6
Binary ceiling a :/ b Returns the greatest multiple of b smaller than or equal to a. For example: 7 :/ 3 == 9
Comparison operators
Equal to a == b  
Not equal to a != b  
Greater than a > b  
Less than a < b  
Greater than or equal to a >= b  
Less than or equal to a <= b