robpike / ivy

ivy, an APL-like calculator
Other
1.32k stars 103 forks source link

Fix `base` op example in demo #128

Closed Blackmane closed 1 year ago

Blackmane commented 1 year ago

The op base doesn't work properly with numbers that are power of the base.

For example:

8 base 2
0 0 0

9 base 3
0 0

This is caused by a mismatch between the log operation that return the power and the representation that in this case need a one more number.

This is evident in the op popcount that with the powers of two doesn't work:

popcount 8
0

popcount 16
0

popcount 32
0

popcount 64
0