aboutsummaryrefslogtreecommitdiff
path: root/stdlib/integers.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-11-24 16:13:23 -0500
committerBruce Hill <bruce@bruce-hill.com>2024-11-24 16:13:23 -0500
commit0e10313d64f54dd587ebbcd5f413bd999333c911 (patch)
tree16a07c4b01467d59807611b23f91f9eb125959e2 /stdlib/integers.c
parent6ecf6a272446af04f3affd354520d21127a5b952 (diff)
Switch `NaN` to be identical to the null value
Diffstat (limited to 'stdlib/integers.c')
-rw-r--r--stdlib/integers.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/stdlib/integers.c b/stdlib/integers.c
index 48ab6019..3b95c994 100644
--- a/stdlib/integers.c
+++ b/stdlib/integers.c
@@ -300,8 +300,10 @@ public Int_t Int$power(Int_t base, Int_t exponent)
return Int$from_mpz(result);
}
-public Int_t Int$sqrt(Int_t i)
+public OptionalInt_t Int$sqrt(Int_t i)
{
+ if (Int$compare_value(i, I(0)) < 0)
+ return NULL_INT;
mpz_t result;
mpz_init_set_int(result, i);
mpz_sqrt(result, result);