Skip to content
Snippets Groups Projects
Commit a737be97 authored by Regis Blanc's avatar Regis Blanc
Browse files

some doc for reals

parent b42165be
No related branches found
No related tags found
No related merge requests found
...@@ -283,6 +283,41 @@ BigInt ...@@ -283,6 +283,41 @@ BigInt
.. note:: .. note::
BigInt are mathematical integers (arbitrary size, no overflows). BigInt are mathematical integers (arbitrary size, no overflows).
Real
####
``Real`` represents the mathematical real numbers (different from floating points). It is an
extension to Scala which is meant to write programs closer to their true semantics.
.. code-block:: scala
val a: Real = Real(2)
val b: Real = Real(3, 5) // 3/5
-a
a + b
a - b
a * b
a / b
a < b
a > b
a <= b
a >= b
a == b
.. note::
Real have infinite precision, which means their properties differ from ``Double``.
For example, the following holds:
.. code-block:: scala
def associativity(x: Real, y: Real, z: Real): Boolean = {
(x + y) + z == x + (y + z)
} holds
While it does not hold with floating point arithmetic.
Set Set
### ###
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment