aboutsummaryrefslogtreecommitdiffhomepage
path: root/std/Math/Rational.bruijn
diff options
context:
space:
mode:
authorMarvin Borner2024-04-13 20:08:09 +0200
committerMarvin Borner2024-04-13 20:08:09 +0200
commitb1062132fc1c2f3fb3b925fb42acc5de7a33f6d3 (patch)
tree177fab9a7b78c4069314693ac977888d6a97ce37 /std/Math/Rational.bruijn
parent1fb92f42ab77da5311e547ddb56de3e5d3cbf988 (diff)
Worked on real numbers
Diffstat (limited to 'std/Math/Rational.bruijn')
-rw-r--r--std/Math/Rational.bruijn5
1 files changed, 5 insertions, 0 deletions
diff --git a/std/Math/Rational.bruijn b/std/Math/Rational.bruijn
index 4c2f046..1f8a8ec 100644
--- a/std/Math/Rational.bruijn
+++ b/std/Math/Rational.bruijn
@@ -8,6 +8,11 @@
:import std/Pair .
:import std/Math N
+# converts a balanced ternary number to a rational number
+number→rational [0 : (+0)] ⧗ Number → Rational
+
+:test (number→rational (+5)) ((+5.0))
+
# returns true if two rational numbers are equal
eq? &[[&[[N.eq? (N.mul 3 N.++0) (N.mul N.++2 1)]]]] ⧗ Rational → Rational → Boolean