mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-23 20:15:05 +02:00
Issue #182 - Misc string->number fixes
This commit is contained in:
parent
bb6d822d92
commit
596869f0e0
1 changed files with 3 additions and 1 deletions
|
@ -1840,6 +1840,8 @@ object Cyc_string2number2_(void *data, object cont, int argc, object str, ...)
|
|||
result = (int)strtol(string_str(str), NULL, 2);
|
||||
} else if (base_num == 8) {
|
||||
result = (int)strtol(string_str(str), NULL, 8);
|
||||
} else if (base_num == 10) {
|
||||
Cyc_string2number_(data, cont, str); // Default processing
|
||||
} else if (base_num == 16) {
|
||||
result = (int)strtol(string_str(str), NULL, 16);
|
||||
}
|
||||
|
@ -1849,7 +1851,7 @@ object Cyc_string2number2_(void *data, object cont, int argc, object str, ...)
|
|||
if (MP_OKAY != mp_read_radix(&(bignum_value(bn)), string_str(str), base_num)) {
|
||||
Cyc_rt_raise2(data, "Error converting string to bignum", str);
|
||||
}
|
||||
_return_closcall1(data, cont, bn);
|
||||
_return_closcall1(data, cont, Cyc_bignum_normalize(data, bn));
|
||||
} else {
|
||||
_return_closcall1(data, cont, obj_int2obj(result));
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue