Download "user manual"

Transcript
Jan Burse
Language Runtime
XLOG Technologies GmbH
Elementary Operations
When the arguments of the binary elementary operations do not have the same types then
widening is applied to them before performing the operation. Widening is done towards the
bigger domain of the two arguments. Widening from integer to float32 or float might fail with
an exception, since the unbounded integers have a greater range than float32 or floats.
The ordering of the domains is as follows:
integer < float32 < float < decimal
The binary decimal operations return the preferred scale as defined in the java class BigDecimal. They thus differ from the usual float32 or float operations in that they work with unlimited precision. There is no division for decimals defined here, the division will convert to float
and perform a float division.
The signature of the available binary and unary elementary operations is listed here:
+, -, *, ^:
/:
+, -, *:
+, -, *:
+, -, *:
-, +, abs, sign:
-, +, abs, sign:
-, +, abs, sign:
-, +, abs, sign:
integer x integer -> integer
number x number -> float
float32 x float32 -> float32
float x float -> float
decimal x decimal -> decimal
integer -> integer
float32 -> float32
float -> float
decimal -> decimal
Examples:
abs(-1)
abs(-1.0)
abs(-0d1.00)
9 + 1
0.99 + 0.01
0d0.990 + 0d0.01
5 * 2
5.0 * 2.0
0d5.0 * 0d2.0
5 / 2
5.0 / 2.0
0d5.00 / 2
3 ^ 27
-->
-->
-->
-->
-->
-->
-->
-->
-->
-->
-->
-->
-->
1
1.0
0d1.00
10
1.0
0d1.000
10
10.0
0d10.00
2.5
2.5
2.5
7625597484987
The unary float32 respective float conversion is approximate for integer and decimal arguments and returns always float32 respective float. The unary decimal conversion is exact for
integer, float32 and float arguments and returns always decimals.
The signature of the available unary conversion operations is listed here:
float32:
float:
decimal:
February 23, 2019
number -> float32
number -> float
number -> decimal
jekejeke_lang_run_2019_02_01_e.docx
Page 77 of 134