nim-lang / bigints

BigInts for Nim
MIT License
123 stars 32 forks source link

JS backend #59

Open konsumlamm opened 2 years ago

konsumlamm commented 2 years ago

I experimented a bit with running the tests on the JS backend, but I came to the conclusion that this is currently not viable. The problem is https://github.com/nim-lang/Nim/issues/4714: 64 bit integers are broken on the JS backend, since they're implemented as floating point values.

We could use std/jsbigints on the JS backend, but I'd rather not do that, since it has a different API, which means we'd have to implement some functions twice. Apart from that, this library wouldn't be a pure Nim implementation anymore then.

konsumlamm commented 2 years ago

A possible (temporary) fix for this would be to use uint16/uint32 instead of uint32/uint64 on the JS backend. That should only require changing a few types and constants, which should be doable by placing some type aliases and consts in a when at the top.