Fixed tests for floatToIntBits. Probably want to add more comprehensive tests tomorrow (or today... as of 2 minutes)

This commit is contained in:
Seth Goings 2011-12-28 23:58:33 -07:00
parent b3850ac76d
commit f5a168f584

View File

@ -212,31 +212,26 @@ public class Floats {
expect(d == 12345.0); expect(d == 12345.0);
} }
{ {
int NaN = 0x7F800001; int orig = 0x7f800001;
float NaN = Float.intBitsToFloat(orig);
int result = Float.floatToIntBits(NaN); int result = Float.floatToIntBits(NaN);
int expected = 0x7fc00000; int expected = 0x7fc00000;
System.out.println("NaN integer is: " + result + " and we were expecting it to be: " + expected);
expect(result == expected); expect(result == expected);
} }
{ {
int number = 0x00800001; int orig = 0x00800001;
float number = Float.intBitsToFloat(orig);
int result = Float.floatToIntBits(number); int result = Float.floatToIntBits(number);
System.out.println("Number1 is: " + result); expect(result == orig);
expect(result == number);
} }
{ {
int number = 0x80800003; int orig = 0x80800003;
float number = Float.intBitsToFloat(orig);
int result = Float.floatToIntBits(number); int result = Float.floatToIntBits(number);
System.out.println("Number2 is: " + result); expect(result == orig);
expect(result == number);
} }
} }
} }