mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-11 00:27:03 +07:00
- more tests (cherry picked from commit 0a0af605b7a6a79427eb88d1f92af728d500932a) GitOrigin-RevId: f9077865cc33ce8c8fbea5394ee1f882df675a11
33 lines
875 B
Java
33 lines
875 B
Java
package dfa;
|
|
|
|
public class BoxedFloatLiterals {
|
|
|
|
int examineFloat(Float f) {
|
|
final Float PInf = Float.POSITIVE_INFINITY;
|
|
final Float NInf = Float.NEGATIVE_INFINITY;
|
|
final Float NaN = Float.NaN;
|
|
return switch (f) {
|
|
case <error descr="Constant expression required">NInf</error> -> -100;
|
|
case -0.0f -> -1;
|
|
case 0.0f -> +1;
|
|
case <error descr="Constant expression required">PInf</error> -> +100;
|
|
case <error descr="Constant expression required">NaN</error> -> 0;
|
|
default -> 42;
|
|
};
|
|
}
|
|
|
|
int examineFloat2(Float f) {
|
|
final float PInf = Float.POSITIVE_INFINITY;
|
|
final float NInf = Float.NEGATIVE_INFINITY;
|
|
final float NaN = Float.NaN;
|
|
return switch (f) {
|
|
case NInf -> -100;
|
|
case -0.0f -> -1;
|
|
case 0.0f -> +1;
|
|
case PInf -> +100;
|
|
case NaN -> 0;
|
|
default -> 42;
|
|
};
|
|
}
|
|
}
|