Issue #182 - string->number fails with #f

Per spec, #f should be returned for a conversion failure. Previously certain bases were returning 0 instead.
This commit is contained in:
Justin Ethier 2017-07-18 17:07:59 +00:00
parent 6ff6e2d92e
commit 03da56a11f

View file

@ -1892,13 +1892,12 @@ object Cyc_string2number2_(void *data, object cont, int argc, object str, ...)
} }
// If result is mp_zero and str does not contain a 0, then fail // If result is mp_zero and str does not contain a 0, then fail
// mp_init(&tmp); mp_init(&tmp);
// mp_zero(&tmp); mp_zero(&tmp);
// if (MP_EQ == mp_cmp(&(bignum_value(bn)), &tmp) && if (MP_EQ == mp_cmp(&(bignum_value(bn)), &tmp) &&
// // TODO: str does not contain '0' NULL == strchr(string_str(str), '0')) {
// ) { _return_closcall1(data, cont, boolean_f);
// _return_closcall1(data, cont, boolean_f); }
// }
_return_closcall1(data, cont, Cyc_bignum_normalize(data, bn)); _return_closcall1(data, cont, Cyc_bignum_normalize(data, bn));
} else { } else {