kclapper / tower.js

Javascript implementation of Scheme's numeric tower
https://kclapper.github.io/tower.js/
Other
0 stars 1 forks source link

New unboxed representation #4

Closed kclapper closed 1 year ago

kclapper commented 1 year ago

This PR changes the unboxed number representation. Before, native JS numbers were treated as exact integers. This meant that any number going into a tower.js function HAD to be an integer. Otherwise nastiness would occur.

Now, native JS numbers are treated as inexact numbers. This is a more intuitive interpretation of JS numbers and the goal is to foster better interoperability with other JS code not using tower.js.

This means that all exact numbers are now boxed.

Ideally, this should mean the trade off is that the original js-numbers library is faster for exact numbers, but tower.js is faster for inexact numbers. The difference being in how they treat unboxed numbers.