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

Owner: Nobody
Requestors: alex.jakimenko [at] gmail.com
Cc:
AdminCc:

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: http://irclog.perlgeek.de/perl6/2016-02-10#i_12017068
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: https://github.com/perl6/roast/blob/a217b1a385eedee0259eb4e2b743304479a01bb5/S03-operators/cmp.t#L68 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 (http://irclog.perlgeek.de/perl6-dev/2016-07-22#i_12884721 ), 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 | https://twitter.com/zoffix


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

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