The following code seems to corrupt the logic of Float.isNaN () on the old Android device. Device: LG-GT540 / Android2.3.7
[IMPORTANT UPDATE] Android on board - SwiftDroid v2.0 ASIS (based on CyanogenMod-7.1.0)
int a = 2;
float b = a;
Log.d("yo", "1, Float.isNaN=" + Float.isNaN(Float.NaN));
boolean test = (b == 2);
Log.d("yo", "2, Float.isNaN=" + Float.isNaN(Float.NaN));
This makes Float.isNaN (Float.NaN) return an false value.
Do you know why?
Is this a JVM bug?
On all the devices that we have, the code works as expected:
1, Float.isNaN=true
2, Float.isNaN=true
But on LG's old Android, the second NaN test fails.
1, Float.isNaN=true
2, Float.isNaN=false
But why?!
Any ideas for solving this case are very welcome!
source
share