aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux
diff options
context:
space:
mode:
Diffstat (limited to 'new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux')
-rw-r--r--new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux78
1 files changed, 0 insertions, 78 deletions
diff --git a/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux
index 88b40bcca..70a9f62df 100644
--- a/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux
@@ -664,83 +664,6 @@
@@bit//logical-right-shift
))
-(runtime: (nat//< param subject)
- (with-vars [pH sH]
- ($_ r.then
- (r.set! pH (..int64-high (@@ param)))
- (r.set! sH (..int64-high (@@ subject)))
- (let [lesser-high? (|> (@@ sH) (r.< (@@ pH)))
- equal-high? (|> (@@ sH) (r.= (@@ pH)))
- lesser-low? (|> (..int64-low (@@ subject)) (r.< (..int64-low (@@ param))))]
- (|> lesser-high?
- (r.or (|> equal-high?
- (r.and lesser-low?))))))))
-
-(runtime: (nat/// parameter subject)
- (let [negative? (int//< int//zero)
- valid-division-check [(|> (@@ parameter) (int//= int//zero))
- (r.stop (r.string "Cannot divide by zero!"))]
- short-circuit-check [(|> (@@ subject) (nat//< (@@ parameter)))
- int//zero]]
- (r.cond (list valid-division-check
- short-circuit-check
-
- [(|> (@@ parameter)
- (nat//< (|> (@@ subject) (bit//logical-right-shift (r.int 1)))))
- int//one])
- (with-vars [result remainder approximate log2 approximate-result approximate-remainder delta]
- ($_ r.then
- (r.set! result int//zero)
- (r.set! remainder (@@ subject))
- (r.while (|> (|> (@@ remainder) (nat//< (@@ parameter)))
- (r.or (|> (@@ remainder) (int//= (@@ parameter)))))
- (let [rough-estimate (r.apply (list (|> (int//to-float (@@ parameter)) (r./ (int//to-float (@@ remainder)))))
- (r.global "floor"))
- calculate-approximate-result (int//from-float (@@ approximate))
- calculate-approximate-remainder (int//* (@@ parameter) (@@ approximate-result))
- delta (r.if (|> (r.float 48.0) (r.<= (@@ log2)))
- (r.float 1.0)
- (r.** (|> (r.float 48.0) (r.- (@@ log2)))
- (r.float 2.0)))
- update-approximates! ($_ r.then
- (r.set! approximate-result calculate-approximate-result)
- (r.set! approximate-remainder calculate-approximate-remainder))]
- ($_ r.then
- (r.set! approximate (r.apply (list (r.float 1.0) rough-estimate)
- (r.global "max")))
- (r.set! log2 (let [log (function (_ input)
- (r.apply (list input) (r.global "log")))]
- (r.apply (list (|> (log (r.int 2))
- (r./ (log (@@ approximate)))))
- (r.global "ceil"))))
- update-approximates!
- (r.while (|> (negative? (@@ approximate-remainder))
- (r.or (|> (@@ approximate-remainder) (int//< (@@ remainder)))))
- ($_ r.then
- (r.set! approximate (|> delta (r.- (@@ approximate))))
- update-approximates!))
- ($_ r.then
- (r.set! result (|> (@@ result)
- (int//+ (r.if (|> (@@ approximate-result) (int//= int//zero))
- int//one
- (@@ approximate-result)))))
- (r.set! remainder (|> (@@ remainder) (int//- (@@ approximate-remainder))))))))
- (@@ result)))
- )))
-
-(runtime: (nat//% param subject)
- (let [flat (|> (@@ subject)
- (nat/// (@@ param))
- (int//* (@@ param)))]
- (|> (@@ subject) (int//- flat))))
-
-(def: runtime//nat
- Runtime
- ($_ r.then
- @@nat//<
- @@nat///
- @@nat//%))
-
(runtime: (deg//* param subject)
(with-vars [sL sH pL pH bottom middle top]
($_ r.then
@@ -1035,7 +958,6 @@
runtime//bit
runtime//int
runtime//adt
- runtime//nat
runtime//deg
runtime//frac
runtime//text