go to previous page   go to home page   go to next page hear noise

Do you think that the following is legal?

8912D 

Answer:

Yes. The 'D' will make the literal a double (even though it lacks a decimal point). However, to avoid confusion, always include a decimal point in a floating point literal, even where it is not required.


Scientific Notation

You will sometimes see scientific notation. The following are all double-precision literals:

 1.23E+02 
 
-1.235E+02 

-1.98234234E+05 
  
 3.81E-06

The big "E" means "times 10 to the power of" . The integer that follows it says what power of ten to multiply the rest of the number by.  

Another way to say this is that the integer that follows "E" says in which direction and for how many places to shift the decimal point. Positive integers mean right shifts; negative integers mean left shifts.


QUESTION 10:

What is the usual way to write this number: 1.9345E+03