Closed NoahStoryM closed 2 years ago
This is a breaking change for these procedures. I would instead recommend defining these variants in a library that you can then import when you want this behavior.
As for allowing 0 arguments, I think there aren't compatibility issues.
The modified max
will ignore the -inf.0
s in the arguments, then return more accurate results (no loss of precision). I guess this change is advocated by r6rs:
Note: If any argument is inexact, then the result is also inexact (unless the procedure can prove that the inaccuracy is not large enough to affect the result, which is possible only in unusual implementations). If min or max is used to compare number objects of mixed exactness, and the numerical value of the result cannot be represented as an inexact number object without loss of accuracy, then the procedure may raise an exception with condition type &implementation-restriction.
Of course if Chez Scheme thinks this change is not recommended, feel free to close this PR. :)
Yes, I think your proposed changes would fit the R6RS specification. However, the changes would break compatibility with Chez Scheme's min & max procedures. Since you can define your own variants of these functions, I do not see a compelling reason to break compatibility.
See https://github.com/racket/racket/issues/4429 and https://github.com/racket/rhombus-prototype/issues/112.
-inf.0
should be the identity element ofmax
, and we can get more accurate results by ignoring the identity elements.Before:
After: