mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-24 12:35:05 +02:00
Initial numerator/denominator complex num support
This commit is contained in:
parent
826e7895ae
commit
48a7958c33
1 changed files with 7 additions and 0 deletions
|
@ -8437,6 +8437,13 @@ void Cyc_get_ratio(void *data, object cont, object n, int numerator)
|
||||||
d = double_value(n);
|
d = double_value(n);
|
||||||
} else if (type_of(n) == bignum_tag) {
|
} else if (type_of(n) == bignum_tag) {
|
||||||
d = mp_get_double(&bignum_value(n));
|
d = mp_get_double(&bignum_value(n));
|
||||||
|
} else if (type_of(n) == complex_num_tag) {
|
||||||
|
// TODO: if i is 0, set d = real part
|
||||||
|
if (numerator) {
|
||||||
|
return_closcall1(data, cont, n);
|
||||||
|
} else {
|
||||||
|
d = 1.0;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Cyc_rt_raise2(data, "Unable to convert to ratio", n);
|
Cyc_rt_raise2(data, "Unable to convert to ratio", n);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue