robpike / ivy

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

encode: support non-integer rhs #136

Closed fzipp closed 1 year ago

fzipp commented 1 year ago
0 24 60 60 encode 1234.567
encode: cannot convert rational to big int
t = sys "sec"
0 24 60 60 encode (sys "sec") - t
encode: cannot convert float to big int

The APL I tried supports this:

0 24 60 60 ⊤ 1234.567
0 0 20 34.567
robpike commented 1 year ago

I did some research last night and have a plan. It's much easier to implement in APL because there is really only one internal number type, not 5. But I figured out a way to make it manageable to implement general modulus, which is the holdup here.