Skip to content

Commit

Permalink
Remove local float operators
Browse files Browse the repository at this point in the history
  • Loading branch information
br4sco committed Apr 6, 2024
1 parent 58e50a4 commit c7298af
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions stdlib/ext/math-ext.mc
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
let _maxf: Float -> Float -> Float = lam r. lam l. if gtf r l then r else l
include "float.mc"

let _absf: Float -> Float = lam f. _maxf f (negf f)

let _eqfApprox = lam epsilon. lam r. lam l.
if leqf (_absf (subf r l)) epsilon then true else false

utest 1. with 1.01 using _eqfApprox 0.011
utest negf 1.0 with negf 1.009 using _eqfApprox 0.01
utest 0.0 with 0.0 using (_eqfApprox 0.)
utest _eqfApprox 0.01 1.0 1.011 with false
utest 1. with 1.000009 using _eqfApprox 0.00001
utest _eqfApprox 0.00001 1.0 1.000011 with false

let _eqf = _eqfApprox 1e-15
let _eqf = eqfApprox 1e-15

utest _maxf 0. 0. with 0. using eqf
utest _maxf 1. 0. with 1. using eqf
Expand Down

0 comments on commit c7298af

Please sign in to comment.