Conflict API definitions of Math.pow(x, 0.5) and Math.sqrt(x) for x={-0.0, Double.NEGATIVE_INFINITY}

Andrew Haley aph at
Mon Apr 12 08:38:29 UTC 2021

On 4/12/21 7:51 AM, jiefu(傅杰) wrote:
> So why Java creates conflict special rules for them?
> Is it possible to let Math.pow(-0.0, 0.5) = -0.0 and Math.pow(Double.NEGATIVE_INFINITY, 0.5) = NaN also be allowed?

These rules are in the C standard too, which is inherited by other
programming languages. Also, please see

Andrew Haley  (he/him)
Java Platform Lead Engineer
Red Hat UK Ltd. <>
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671

More information about the hotspot-compiler-dev mailing list