Numeric Limits

Aus expecco Wiki (Version 2.x)
Version vom 17. Februar 2017, 12:43 Uhr von Cg (Diskussion | Beiträge) (Die Seite wurde neu angelegt: „== Integer Arithmetic == Expecco supports arbitrary precision integer arithmetic, arbitrary precision fractions and limited precision floating point numbers. …“)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Zur Navigation springen Zur Suche springen

Integer Arithmetic[Bearbeiten]

Expecco supports arbitrary precision integer arithmetic, arbitrary precision fractions and limited precision floating point numbers.

For integer operations, there is no overflow or error in the result for any legal operation. I.e. operations on two big numbers deliver a correct result:

4294967295 (0xFFFFFFFF) + 1 -> 4294967296 (0x100000000)
18446744073709551615 (0xFFFFFFFFFFFFFFFF) + 1 -> 18446744073709551616 (0x10000000000000000)


when dividing integers, the "/" operator will deliver an exact result, possibly as a fraction:

5 / 3 -> 5/3

and the truncating division "//" will deliver an integer, truncated towards negative infinity (i.e. the next smaller integer):

5 // 3 -> 2
-5 // 3 -> -3

Trigonmetric and other Math Functions[Bearbeiten]

Trigonometric functions when applied to integer or fractional numbers will first convert the number to a limited precision real number (a C-double), and therefore may have a limited input value range.

For example, you will not get a valid result for:

10000 factorial sin

because it is not possible to represent that large number as real number. (expecco will signal a domain error, as the input to sin will be +INF)



Copyright © 2014-2024 eXept Software AG