summaryrefslogtreecommitdiffstats
path: root/stdlib/doc-lookup.tl
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-10-09 22:53:29 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-10-09 22:53:29 -0700
commitc9d98cf5b72dc5408687c27d9ce5873ddf6aa695 (patch)
treee0718c7ab59283f014bf99a910ac23aea9d14146 /stdlib/doc-lookup.tl
parent60b367cddd49f3d387851746ad1699eeb654da49 (diff)
downloadtxr-c9d98cf5b72dc5408687c27d9ce5873ddf6aa695.tar.gz
txr-c9d98cf5b72dc5408687c27d9ce5873ddf6aa695.tar.bz2
txr-c9d98cf5b72dc5408687c27d9ce5873ddf6aa695.zip
math: two bad edge cases in double_uintptr_t conversion.
This fixes two failing test cases introduced in the parent commit. * arith.c (c_dbl_unum): Here, what is wrong that if the incoming value is a CHR or NUM, we just convert it to a signed cnum, and return that value. The problem with this is that negative values are supposed to be out of range for double_uintptr_t. We now check for negative and route to the out-of-range error. * mpi/mpi.c (s_mp_in_big_range): Here, the edge case of handling the most negative two's complement value is incorrectly coded. We replace the logic by a simple test for that exact special case. If a negative bignum being tested whether it fits into the signed double_intptr_t, then we check whether its mantissa has the 0x80..00 bit pattern. That is the only value greater than 0x7F..FF that is still in range, so we return 1 for that case. We remove the bogus subtraction (top - neg). After handling the above special value, we just need to look whether the most significant word of the bignum is 0x7F...FF or lower.
Diffstat (limited to 'stdlib/doc-lookup.tl')
0 files changed, 0 insertions, 0 deletions