paulk-asert opened a new pull request, #3053: URL: https://github.com/apache/groovy/pull/3053
… when an operand is NaN When both operands of a comparison are primitive double or float values, the comparison was compiled to DCMPG (FCMPG) for every ordered operator. DCMPG pushes 1 when either operand is NaN, so > and >= evaluated to true. javac uses DCMPL (FCMPL) for > and >= and DCMPG (FCMPG) for < and <=, so that every comparison with a NaN operand is false (JLS 15.20.1), which Groovy already gave for two Double objects. BinaryExpressionWriter gains a getCompareCode(int) hook, used by writeStdCompare, and the double and float helpers choose the instruction per operator. Comparisons through Groovy's number comparison (mixed operand types, == on Double objects) and <=> are unchanged. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
