[gambit-list] Simple benchmark of |->integer| and |->flonum| on integer, flonum and rational input. For the further if you have any idea of a definition faster than (inexact->exact (floor n)) feel free to share :)
Bradley Lucier
lucier at math.purdue.edu
Tue Apr 30 11:41:03 EDT 2013
On 04/24/2013 10:01 PM, Mikael wrote:
> Hi Brad,
>
>
> ((##ratnum? n) (##inexact->exact (##floor n)))
The floor of a ratnum is always exact, so you could save a trampoline
call here by not calling inexact->exact.
About the semantics of numerical operations in Scheme---I don't really
know what to say. I'd suggest thinking of all operations as the same as
in grade-school mathematics with integers of arbitrary size, rational
numbers, etc. Then layer on top of that some understanding of how
flonums work and how they interact with other types of numbers. It's
hard to get the conventions of other languages out of one's head.
Brad
More information about the Gambit-list
mailing list