justinethier / cyclone

:cyclone: A brand-new compiler that allows practical application development using R7RS Scheme. We provide modern features and a stable system capable of generating fast native binaries.
http://justinethier.github.io/cyclone/
MIT License
823 stars 42 forks source link

Rationals (not supported) cause Cyclone to give some confusing answers #513

Closed jpellegrini closed 9 months ago

jpellegrini commented 11 months ago

Hello! I think I found another issue:

cyclone> (expt 81 1/4)
Error: ("Bad argument type" 81 #f)      ;; Hm, perhaps the message could be clearer? 
                                        ;; The #f refers to the 1/4 that Cyclone doesn't support right?
cyclone> (expt 81.0 1/4)
1.0                                     ;; Hm, nope. :)
cyclone> (expt 81.0 0.25)
3.0                                     ;; Ah, better!

So the rational seems to trigger some confusing behavior, no?

justinethier commented 11 months ago

Thanks for the report, you keep finding interesting edge cases! :)

justinethier commented 9 months ago

Enhanced the reader to recognize rationals, though they are stored internally as doubles rather than a distinct type:

cyclone> (expt 81 1/4)
3.0
cyclone> (expt 81.0 1/4)
3.0
cyclone> 1/4
0.25