Skip to content

Commit

Permalink
sqrt
Browse files Browse the repository at this point in the history
  • Loading branch information
aslanix committed Feb 19, 2024
1 parent beb3825 commit 414cc82
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions compiler/src/IR.hs
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ instance WellFormedIRCheck IRExpr where
, "_setFailureRate"
, "sleep"
, "spawn"
, "sqrt"
, "substring"
, "stringToInt"
, "restore"
Expand Down
7 changes: 7 additions & 0 deletions rt/src/builtins/math.mts
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,12 @@ export function BuiltinMath <TBase extends Constructor<UserRuntimeZero>> (Base:T
assertIsNumber(arg);
return this.runtime.ret(new LVal(Math.floor(arg.val), arg.lev, arg.tlev));
})

sqrt = mkBase((arg) => {
assertIsNumber(arg);
return this.runtime.ret(new LVal(Math.sqrt(arg.val), arg.lev, arg.tlev));
})


}
}

0 comments on commit 414cc82

Please sign in to comment.