Skip Menu |
Report information
Id: 127506
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: alex.jakimenko [at]

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)

Subject: min(NaN, Inf) is Inf but max(NaN, Inf) is NaN
Download (untitled) / with headers
text/plain 140b
Code: say min NaN, Inf, -Inf; say max NaN, Inf, -Inf; Result: -Inf NaN See IRC log:
Question for @LARRY: what should the results be here for min/max/minmax? ----- Currently, we're using `cmp` semantics and there are spec tests for Inf cmp NaN case: In this case, those semantics produce these weird results, however. Most weird is probably what `minmax` produces: <Zoffix> m: say minmax NaN, Inf, -Inf; <camelia> rakudo-moar d789da: OUTPUT«-Inf..NaN␤» Per conversation today ( ), IEEE spec says comparisons with NaN should result in a NaN. Referring to the conversation linked in the OP, mathematically, it sorta makes sense to ignore NaNs and return -Inf..Inf/Inf/-Inf as results. However, NaNs in a program would likely appear as a result of some errors or anomalies. I would not want my code to to just silently ignore them. Thus, my vote is to have min/max return a NaN if any of the values is a NaN. minmax would return a NaN..NaN -- Cheers, ZZ |

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at