Issue #433 - Special case, denominator of 0 is 1

This commit is contained in:
Justin Ethier 2021-07-22 17:16:53 -04:00
parent 95c3fea24f
commit 826e7895ae

View file

@ -8441,7 +8441,11 @@ void Cyc_get_ratio(void *data, object cont, object n, int numerator)
Cyc_rt_raise2(data, "Unable to convert to ratio", n);
}
{
if (!numerator && d == 0.0) {
// Special case
make_double(val, 1.0);
return_closcall1(data, cont, &val);
} else {
double numer, denom;
make_double(val, 0.0);
num2ratio(d, &numer, &denom);