larcenists / larceny

Larceny Scheme implementation
Other
202 stars 32 forks source link

exact-integer-sqrt doesn't work with large arguments in Petit Larceny #801

Closed WillClinger closed 7 years ago

WillClinger commented 7 years ago
Petit Larceny v1.1a2 (precise:Linux)

> (exact-integer-sqrt #e1e20)

Error: bytevector-like-set!: illegal third argument: 6027  cannot be stored in a bytevector-like
WillClinger commented 7 years ago

Fixed by changeset 5af5135be749d05f4c6ce013a3e3f3db865147bf

This was a bug in bignum-shift-right! and was caused by failing to mask off the low-order byte of a shifted number. Apparently bytevector-like-set! does that masking itself in native Larceny but not in Petit Larceny.

This bug was detected by the standard tests, so no regression test is necessary. Will believes this bug was introduced after v0.99 was released, so this bug was not present in any public release of Petit Larceny.