pxeger / whython

Fork of Python with some terrible custom features hacked in
https://www.pxeger.com/2021-09-19-hacking-on-cpython/
Other
16 stars 3 forks source link

log2 numeric type #15

Open mvirts opened 2 years ago

mvirts commented 2 years ago

New numeric type that only stores the next lower power of 2

print(log2(16)) 16 print(log2(19)) 16 print(log2(9)) 8

it would still participate in math operations like a normal integer, but would only store the exponent.

Could also introduce types in other bases (8,10,16,64)

alternate names 'sinking point' sink2 'point blank' pb2 'exponent 2' xp2 'just the point' jtp2 'mantissaless float' mf2 'one float' of2

math.log2 specialization would be easy to implement