Tuesday 12 March 2013

Fields POSITIVE_INFINITY


Fields
POSITIVE_INFINITY

Declaration:
public static final float POSITIVE_INFINITY
Description:
The positive infinity of type float. It is equal to the value returned by
Float.intBitsToFloat(0x7f800000).
NEGATIVE_INFINITY
Declaration:
public static final float NEGATIVE_INFINITY
Description:
The negative infinity of type float. It is equal to the value returned by
Float.intBitsToFloat(0xff800000).
NaN
Declaration:
public static final float NaN
Description:
The Not-a-Number (NaN) value of type float. It is equal to the value returned by
Float.intBitsToFloat(0x7fc00000).
MAX_VALUE
Declaration:
public static final float MAX_VALUE
Description:
The largest positive value of type float. It is equal to the value returned by
Float.intBitsToFloat(0x7f7fffff).
MIN_VALUE
Declaration:
public static final float MIN_VALUE

Description:
The smallest positive value of type float. It is equal to the value returned by
Float.intBitsToFloat(0x1).
Constructors
Float(float)
Declaration:
public Float(float value)
Description:
Constructs a newly allocated Float object that represents the primitive float argument.
Parameters:
value - the value to be represented by the Float.
Float(double)
Declaration:
public Float(double value)
Description:
Constructs a newly allocated Floatobject that represents the argument converted to type float.
Parameters:
value - the value to be represented by the Float.

Methods
toString(float)
Declaration:
public static java.lang.String toString(float f)
Description:
Returns a String representation for the specified float value. The argument is converted to a readable string
format as follows. All characters and characters in strings mentioned below are ASCII characters.
• If the argument is NaN, the result is the string “NaN”.
• Otherwise, the result is a string that represents the sign and magnitude (absolute value) of the argument.
If the sign is negative, the first character of the result is '-' ('-'); if the sign is positive, no sign
character appears in the result. As for the magnitude m:
• If m is infinity, it is represented by the characters “Infinity”; thus, positive infinity produces the
result “Infinity” and negative infinity produces the result “-Infinity”.
• If m is zero, it is represented by the characters “0.0”; thus, negative zero produces the result “-
0.0” and positive zero produces the result “0.0”.
• If m is greater than or equal to 10-3 but less than 107, then it is represented as the integer part of m, in
decimal form with no leading zeroes, followed by '.' (.), followed by one or more decimal digits
representing the fractional part of m.

valueOf(String)
• If m is less than 10-3 or not less than 107, then it is represented in so-called “computerized scientific
notation.” Let n be the unique integer such that 10n<=m<1; then let a be the mathematically exact
quotient of m and 10n so that 1<a&lt10. The magnitude is then represented as the integer part of a, as
a single decimal digit, followed by '.' (.), followed by decimal digits representing the fractional
part of a, followed by the letter 'E' (E), followed by a representation of n as a decimal integer, as
produced by the method Integer.toString(int) of one argument.
How many digits must be printed for the fractional part of m or a? There must be at least one digit to
represent the fractional part, and beyond that as many, but only as many, more digits as are needed to
uniquely distinguish the argument value from adjacent values of type float. That is, suppose that x is the
exact mathematical value represented by the decimal representation produced by this method for a finite
nonzero argument f. Then f must be the float value nearest to x; or, if two float values are equally close to
xthen f must be one of them and the least significant bit of the significand of f must be 0.
Parameters:
f - the float to be converted.
Returns: a string representation of the argument.
valueOf(String)
Declaration:
public static java.lang.Float valueOf(java.lang.String s)
throws NumberFormatException
Description:
Returns the floating point value represented by the specified String. The string s is interpreted as the
representation of a floating-point value and a Float object representing that value is created and returned.
If s is null, then a NullPointerException is thrown.
Leading and trailing whitespace characters in s are ignored. The rest of s should constitute a FloatValue as
described by the lexical syntax rules:
FloatValue:
Signopt FloatingPointLiteral
where Sign, FloatingPointLiteral are as defined in Section 3.10.2 of the Java Language Specification (http:/
/java.sun.com/docs/books/jls/html/). If it does not have the form of a FloatValue, then a
NumberFormatException is thrown. Otherwise, it is regarded as representing an exact decimal value
in the usual “computerized scientific notation”; this exact decimal value is then conceptually converted to
an “infinitely precise” binary value that is then rounded to type float by the usual round-to-nearest rule of
IEEE 754 floating-point arithmetic.
Parameters:
s - the string to be parsed.
Returns: a newly constructed Float initialized to the value represented by the String argument.
Throws:
NumberFormatException - if the string does not contain a parsable number.

parseFloat(String)
Declaration:
public static float parseFloat(java.lang.String s)
throws NumberFormatException

Description:
Returns a new float initialized to the value represented by the specified String.
Parameters:
s - the string to be parsed.
Returns: the float value represented by the string argument.
Throws:
NumberFormatException - if the string does not contain a parsable float.







No comments:

Post a Comment