Of course, a leading 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 of using characters to
express a number.
When it is converted to a double
you get the same
double
that you would get with ordinary notation.
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
.
Here is an example:
C:\temp>java DoubleDouble Enter a double: 1.234E+9 value: 1.234E9 twice value: 2.468E9
The "E" may be upper or lower case:
C:\temp>java DoubleDouble Enter a double: -7.001e-2 value: -0.07001 twice value: -0.14002
Scientific notation is a format used for strictly 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.
In the previous example, scientific notation was used with the
characters that were read in.
Those characters were converted to a double
value.
Some arithmetic was done with that value and the results were converted
to characters and written out.
Since the values were in the normal range of numbers,
ordinary formats were used for the output characters.
What is the meaning of 7.0E-2
?