support for Real.isInfitite and isNan

This commit is contained in:
sergeych committed 2026-03-31 19:08:11 +03:00
1 parent 850efedb72
commit a976702caf
4 files changed
+134

No files matched your search

@@ -155,6 +155,22 @@ data class ObjReal(val value: Double) : Obj(), Numeric {
) {
ObjInt.of(thisAs<ObjReal>().value.toLong())
}
addFnDoc(
name = "isInfinite",
doc = "Return true if this real number is positive or negative infinity.",
returns = type("lyng.Bool"),
moduleName = "lyng.stdlib"
) {
ObjBool(thisAs<ObjReal>().value.isInfinite())
}
addFnDoc(
name = "isNaN",
doc = "Return true if this real number is NaN (not a number).",
returns = type("lyng.Bool"),
moduleName = "lyng.stdlib"
) {
ObjBool(thisAs<ObjReal>().value.isNaN())
}
}
}
}