Numeric Limits: Unterschied zwischen den Versionen

Aus expecco Wiki (Version 2.x)
Zur Navigation springen Zur Suche springen
(Die Seite wurde neu angelegt: „== Integer Arithmetic == Expecco supports arbitrary precision integer arithmetic, arbitrary precision fractions and limited precision floating point numbers. …“)
 
(Weiterleitung nach Numeric Limits/en erstellt)
 
(10 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 1: Zeile 1:
#redirect [[ Numeric Limits/en]]
== Integer Arithmetic ==

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 ==

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)

Aktuelle Version vom 21. Februar 2017, 20:27 Uhr

Weiterleitung nach:



Copyright © 2014-2024 eXept Software AG