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

Implement r7rs round to even behaviour for half integers #524

Closed yorickhardy closed 6 months ago

yorickhardy commented 6 months ago

R7RS requires (round x) to round to even when x is halfway between two integers. The current implementation uses round() which rounds away from zero.

This pull request adds two tests for the half integer behavior, and an implementation that rounds to even for the half integer case.

justinethier commented 6 months ago

This is great - thanks for the PR @yorickhardy!