mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-16 09:17:35 +02:00
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:
parent
6ff6e2d92e
commit
03da56a11f
1 changed files with 6 additions and 7 deletions
13
runtime.c
13
runtime.c
|
@ -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
|
||||
// mp_init(&tmp);
|
||||
// mp_zero(&tmp);
|
||||
// if (MP_EQ == mp_cmp(&(bignum_value(bn)), &tmp) &&
|
||||
// // TODO: str does not contain '0'
|
||||
// ) {
|
||||
// _return_closcall1(data, cont, boolean_f);
|
||||
// }
|
||||
mp_init(&tmp);
|
||||
mp_zero(&tmp);
|
||||
if (MP_EQ == mp_cmp(&(bignum_value(bn)), &tmp) &&
|
||||
NULL == strchr(string_str(str), '0')) {
|
||||
_return_closcall1(data, cont, boolean_f);
|
||||
}
|
||||
|
||||
_return_closcall1(data, cont, Cyc_bignum_normalize(data, bn));
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue