Yes, the minus sign is acceptable:
C:\temp>java DoubleDouble Enter a double: -97.65 value: -97.65 twice value: -195.3
Scientific notation is another way to write a number.
In scientific notation, the letter E
is used to mean
"10 to the power of."
For example,
1.314E+1
means 1.314 * 101
which is 13.14
.
Scientific notation is merely a format used for input and output.
The 64-bit pattern used for a double
inside
the computer are the same, no matter what character format was used
for input.
Here is an example:
C:\temp>java DoubleDouble Enter a double: 1.234E+9 value: 1.234E9 twice value: 2.468E9
Here the user entered data using scientific notation,
and nextDouble()
converted those characters into a double
.
If the user entered 1234000000
, those characters would be converted
into the same double
.
When a double
is converted into characters,
scientific notation is used when needed for very large or very small values.
The input characters may use an upper or lower case "e":
C:\temp>java DoubleDouble Enter a double: -7.001e-2 value: -0.07001 twice value: -0.14002
In this example, the user chose scientific notation for input. On output, the values were in the normal range and the ordinary number format was used.
What is the meaning of 7.0E-2
?