mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-19 05:39:17 +02:00
Merge branch 'issue-509'
This commit is contained in:
commit
0533d3eab0
2 changed files with 38 additions and 7 deletions
|
@ -5,6 +5,7 @@
|
|||
Bug Fixes
|
||||
|
||||
- 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.
|
||||
- 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.
|
||||
|
|
40
runtime.c
40
runtime.c
|
@ -1859,9 +1859,24 @@ int FUNC_OP(void *data, object x, object y) { \
|
|||
} else if (tx == double_tag && ty == bignum_tag) { \
|
||||
result = (double_value(x)) OP mp_get_double(&bignum_value(y)); \
|
||||
} else if (tx == complex_num_tag && ty == complex_num_tag) { \
|
||||
if (BN_CMP == CYC_BN_EQ) { \
|
||||
result = (complex_num_value(x)) == (complex_num_value(y)); \
|
||||
} else if (tx == complex_num_tag && ty != complex_num_tag) { \
|
||||
} else if (tx != complex_num_tag && ty == complex_num_tag) { \
|
||||
} else { \
|
||||
make_string(s, "Complex comparison operation not allowed"); \
|
||||
make_pair(c2, y, NULL); \
|
||||
make_pair(c1, x, &c2); \
|
||||
make_pair(c0, &s, &c1); \
|
||||
Cyc_rt_raise(data, &c0); \
|
||||
} \
|
||||
} else if ((tx == complex_num_tag && ty != complex_num_tag) || \
|
||||
(tx != complex_num_tag && ty == complex_num_tag)) { \
|
||||
if (BN_CMP != CYC_BN_EQ) { \
|
||||
make_string(s, "Complex comparison operation not allowed"); \
|
||||
make_pair(c2, y, NULL); \
|
||||
make_pair(c1, x, &c2); \
|
||||
make_pair(c0, &s, &c1); \
|
||||
Cyc_rt_raise(data, &c0); \
|
||||
} \
|
||||
} else { \
|
||||
make_string(s, "Bad argument type"); \
|
||||
make_pair(c1, y, NULL); \
|
||||
|
@ -1937,10 +1952,25 @@ object FUNC_FAST_OP(void *data, object x, object y) { \
|
|||
} else if (tx == double_tag && ty == bignum_tag) { \
|
||||
return (double_value(x)) OP mp_get_double(&bignum_value(y)) ? boolean_t : boolean_f; \
|
||||
} else if (tx == complex_num_tag && ty == complex_num_tag) { \
|
||||
if (BN_CMP == CYC_BN_EQ) { \
|
||||
return ((complex_num_value(x)) == (complex_num_value(y))) ? boolean_t : boolean_f; \
|
||||
} else if (tx == complex_num_tag && ty != complex_num_tag) { \
|
||||
return boolean_f; \
|
||||
} else if (tx != complex_num_tag && ty == complex_num_tag) { \
|
||||
} else { \
|
||||
make_string(s, "Complex comparison operation not allowed"); \
|
||||
make_pair(c2, y, NULL); \
|
||||
make_pair(c1, x, &c2); \
|
||||
make_pair(c0, &s, &c1); \
|
||||
Cyc_rt_raise(data, &c0); \
|
||||
return NULL; \
|
||||
} \
|
||||
} else if ((tx == complex_num_tag && ty != complex_num_tag) || \
|
||||
(tx != complex_num_tag && ty == complex_num_tag)) { \
|
||||
if (BN_CMP != CYC_BN_EQ) { \
|
||||
make_string(s, "Complex comparison operation not allowed"); \
|
||||
make_pair(c2, y, NULL); \
|
||||
make_pair(c1, x, &c2); \
|
||||
make_pair(c0, &s, &c1); \
|
||||
Cyc_rt_raise(data, &c0); \
|
||||
} \
|
||||
return boolean_f; \
|
||||
} else { \
|
||||
goto bad_arg_type_error; \
|
||||
|
|
Loading…
Add table
Reference in a new issue