Issue #506 - abs returns an error for complex nums

This commit is contained in:
Justin Ethier 2023-08-15 18:46:30 -07:00
parent 6c4de85c87
commit fd56e21e90
2 changed files with 3 additions and 0 deletions

View file

@ -4,6 +4,7 @@
Bug Fixes
- lassik and jpellegrini reported that `abs` was incorrectly returning the real part of a complex number argument. Modified `abs` to return an error for complex numbers.
- jpellegrini fixed `(srfi 143)` so that the following are constants instead of procedures: `fx-width`, `fx-greatest`, and `fx-least`.
- Raise an error if `odd?` or `even?` is passed a decimal number. Thanks to jpellegrini for the bug report.
- Fix `read-line` to read entire lines that consist of more than 1022 bytes. Previously the function would only return partial data up to this limit. Thanks to Robby Zambito for the bug report.

View file

@ -1395,6 +1395,8 @@
alloc_bignum(data, bn);
BIGNUM_CALL(mp_abs(&bignum_value(num), &bignum_value(bn)));
return_closcall1(data, k, bn);
} else if (is_object_type(num) && type_of(num) == complex_num_tag){
Cyc_rt_raise2(data, \"Unable to compute absolute value of complex number\", num);
} else {
make_double(d, fabs(((double_type *)num)->value));
return_closcall1(data, k, &d);