diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a8a72dc..64fc54c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ Bug Fixes - Fix `exact` to properly handle complex numbers, including raising an error when passed `nan` or `inf` double values. - Ensure the runtime properly differentiates between `+inf.0` and `-inf.0`. Thanks to jpellegrini for the bug report. - jpellegrini reported that Cyclone returns `#f` when comparing complex numbers using operators other than `=`. Instead it is better to raise an error in these situations. -- 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. +- lassik and jpellegrini reported that `abs` was incorrectly returning the real part of a complex number argument. Modified `abs` to properly handle 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. diff --git a/scheme/base.sld b/scheme/base.sld index 81f78782..708c17b8 100644 --- a/scheme/base.sld +++ b/scheme/base.sld @@ -1400,7 +1400,8 @@ 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); + make_double(d, cabs(((complex_num_type *)num)->value)); + return_closcall1(data, k, &d); } else { make_double(d, fabs(((double_type *)num)->value)); return_closcall1(data, k, &d);