Skip to content

Commit 414cc82

Browse files
committed
sqrt
1 parent beb3825 commit 414cc82

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

compiler/src/IR.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ instance WellFormedIRCheck IRExpr where
292292
, "_setFailureRate"
293293
, "sleep"
294294
, "spawn"
295+
, "sqrt"
295296
, "substring"
296297
, "stringToInt"
297298
, "restore"

rt/src/builtins/math.mts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,12 @@ export function BuiltinMath <TBase extends Constructor<UserRuntimeZero>> (Base:T
2626
assertIsNumber(arg);
2727
return this.runtime.ret(new LVal(Math.floor(arg.val), arg.lev, arg.tlev));
2828
})
29+
30+
sqrt = mkBase((arg) => {
31+
assertIsNumber(arg);
32+
return this.runtime.ret(new LVal(Math.sqrt(arg.val), arg.lev, arg.tlev));
33+
})
34+
35+
2936
}
3037
}

0 commit comments

Comments
 (0)