diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-11-24 16:13:23 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-11-24 16:13:23 -0500 |
| commit | 0e10313d64f54dd587ebbcd5f413bd999333c911 (patch) | |
| tree | 16a07c4b01467d59807611b23f91f9eb125959e2 /stdlib/integers.c | |
| parent | 6ecf6a272446af04f3affd354520d21127a5b952 (diff) | |
Switch `NaN` to be identical to the null value
Diffstat (limited to 'stdlib/integers.c')
| -rw-r--r-- | stdlib/integers.c | 4 |
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); |
