updated hak_sqrtint() to return an error if a negative number is given.

added more primitives in the core module
This commit is contained in:
2025-09-25 01:33:54 +09:00
parent d5eade91db
commit 4c000c2c9c
5 changed files with 97 additions and 68 deletions

View File

@ -4828,11 +4828,16 @@ hak_oop_t hak_sqrtint (hak_t* hak, hak_oop_t x)
if (HAK_UNLIKELY(!a)) goto oops;
if (a == hak->_true)
{
#if 0
/* the given number is a negative number.
* i will arrange the return value to be negative. */
x = hak_negateint(hak, x);
if (HAK_UNLIKELY(!x)) goto oops;
neg = 1;
#else
hak_seterrbfmt(hak, HAK_EINVAL, "negative number - %O", x);
goto oops;
#endif
}
else neg = 0;