On Fri, 17 Feb 2023 19:33:07 GMT, Joe Darcy <[email protected]> wrote:
>> src/java.base/share/classes/java/lang/FdLibm.java line 458:
>>
>>> 456: case 0, 1 -> y; // atan(+/-0, +anything)
>>> = +/-0
>>> 457: case 2 -> Math.PI + tiny; // atan(+0, -anything)
>>> = pi
>>> 458: default -> -Math.PI - tiny; // atan(-0, -anything)
>>> = -pi
>>
>> The original switch statement and this switch expression are semantically
>> equivalent only because of our knowledge that `m` can only assume values 0,
>> 1, 2, or 3. This requires more reasoning than a more verbatim copy of the
>> original statement. Not sure if it is worth.
>>
>> The same holds for the switch expressions below.
>
> Yes, the use of switch expressions here is certainly not strictly necessary.
>
> Something that helped convince me it was okay was that the final switch on m
> in atan2 uses the set of case labels {0, 1, 2, default}., further implying
> that m can only take on the values {0, 1, 2, 3}.
Reverted to switch statements rather than switch expressions.
-------------
PR: https://git.openjdk.org/jdk/pull/12608