Commit graph

9 commits

Author SHA1 Message Date
8ee28f692a Add reference to bqn-safetensors 2024-11-15 21:35:48 +01:00
9a1d251716 Fix issue with unsigned integers
Fixes https://github.com/dlozeve/bqn-npy/issues/1.

The spec says that •bit._cast should support 32-bit uints [1], but
CBQN does not [2].

To get around this, we just use signed integers, which works for
numbers smaller than 2^31. Above that, it will wrap around
and (probably) fail, but CBQN does not support them anyway (except by
converting them to doubles).

From Marshall:

> All of the provided functions at this time are identical on i32 and
> u32, because they work (mod 2^32) and the only difference between
> those formats is to add or subtract 2^32 from numbers outside the
> range [0,2^31).
> If you want to run on u32s stored directly as numbers in BQN (they
> won't fit in i32 and will be stored as double!) you can •bit._cast
> those into a signed format at the beginning and then back out at the
> end.

[1] https://mlochbaum.github.io/BQN/spec/system.html#bitwise-operations
[2] https://matrix.to/#/!EjsgbQQNuTfHXQoiax:matrix.org/$PL2AYNlLQuYhPftdt7yw7rW9heiVEEeATte2zOt2BYk
2024-11-11 22:58:04 +01:00
8beeb7d6bd Add trailing comma to shape string 2023-10-20 18:30:18 +02:00
de880a1fbb Fix SaveNpy so that it saves in the interpreter's current directory 2023-10-20 18:29:52 +02:00
1c6c3b8df7 Add license and readme 2023-10-04 17:23:55 +02:00
b868903a81 Add tests 2023-10-04 17:21:45 +02:00
e1fe03d236 Raise an error when attempting to read an unsupported dtype 2023-10-04 17:15:51 +02:00
2610d9e8b2 Allow to read and write more dtypes 2023-10-04 17:15:13 +02:00
9b2e9b184f Initial commit 2023-10-04 13:26:25 +02:00