20.9
java.lang.Float
THE PACKAGE JAVA.LANG
20.9.15
public double doubleValue()
The
float
value represented by this
Float
object is converted ( 5.1.2) to type
double
and the result of the conversion is returned.
Overrides the
doubleValue
method of
Number
( 20.6.4).
20.9.16
public static String toString(float f)
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 (abso
lute value) of the argument. If the sign is negative, the first character of the
result is
(
\u002d
); if the sign is positive, no sign character appears in
the result. As for the magnitude
m
:
N
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"
.
N
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"
.
N
If
m
is greater than or equal to 10
3
but less than 10
7
, then it is represented
as the integer part of
m
, in decimal form with no leading zeroes, followed by
.
(
\u002E
), followed by one or more decimal digits representing the
fractional part of
m
.
N
If
m
is less than 10
3
or not less than 10
7
, then it is represented in so called
computerized scientific notation. Let
n
be the unique integer such that
10
n
m
<
10
n
+ 1
; then let
a
be the mathematically exact quotient of
m
and
10
n
so that 1
a
<
10 . The magnitude is then represented as the integer part
of
a
, as a single decimal digit, followed by
.
(
\u002E
), followed by deci
mal digits representing the fractional part of
a
, followed by the letter
E
(
\u0045
), followed by a representation of
n
as a decimal integer, as pro
duced by the method
Integer.toString
of one argument ( 20.7.12).
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
506
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved