[Date Prev][Date Next]
Re: ordered indexing for integers
> It makes more sense to check for ridiculous-sized numbers before
> parsing them and just output a min/max value depending on sign. (Or
> right-truncate e.g. n*12 digits and add n*5 to the length.)
Committed. Chopping n*7 digits and adding n*3 to the binary-integer
length instead. More wasteful of the exponent bits, but leaves fewer
digits to parse.
Could possibly chop just as many digits as needed and compute the length
more exactly, but I wasn't up to figuring out what algorithm to use so
an exponent taken from the parsed digits could add to overlap an
exponent taken from chopping. Will fiddle a bit with it now and see if
I come up with something.
One detail: Looks like lutil_str2bin() could use a ctx parameter,
for the temporary malloc/free in that function.