corda/classpath/java/lang/Float.java

75 lines
1.5 KiB
Java
Raw Normal View History

/* Copyright (c) 2008, Avian Contributors
Permission to use, copy, modify, and/or distribute this software
for any purpose with or without fee is hereby granted, provided
that the above copyright notice and this permission notice appear
in all copies.
There is NO WARRANTY for this software. See license.txt for
details. */
package java.lang;
public final class Float extends Number {
public static final Class TYPE = Class.forCanonicalName("F");
2007-07-27 02:39:53 +00:00
private final float value;
public Float(float value) {
this.value = value;
}
public static Float valueOf(float value) {
return new Float(value);
}
public boolean equals(Object o) {
return o instanceof Float && ((Float) o).value == value;
}
public int hashCode() {
return floatToRawIntBits(value);
}
public String toString() {
return toString(value);
}
public static String toString(float v) {
return Double.toString(v);
}
public byte byteValue() {
return (byte) value;
}
public short shortValue() {
return (short) value;
}
public int intValue() {
return (int) value;
}
public long longValue() {
return (long) value;
}
public float floatValue() {
return value;
}
public double doubleValue() {
return (double) value;
}
public static float parseFloat(String s) {
// todo
throw new NumberFormatException(s);
}
public static native int floatToRawIntBits(float value);
public static native float intBitsToFloat(int bits);
}