Scientific notation

From QB64 Wiki
Revision as of 16:11, 11 November 2010 by imported>Clippy
Jump to navigation Jump to search

Scientific notation or exponential notation is used to express very large or small numerical values by SINGLE or DOUBLE accuracy.


Usage: -9.7587E+04 or 4.6545D-9


  • E denotes SINGLE precision accuracy and D denotes DOUBLE precision accuracy in Qbasic.
  • To translate the notation, multiply the number preceding the letter by the value of 10 raised to the power following the letter.
  • Note: Naturally calculating the value in Qbasic would return the same value expression!


Example 1: +2.184D+3 means to multiply 2.184 by 1,000 (1,000 is 10 raised to the third power, or 10 ^ 3 ).

To multiply by 10 raised to a positive power, just move the decimal point to the right by 3.
The result is 2184 in DOUBLE accuracy.

Example 2: -5.412D-2 is negative 5.412 times .01 (10 raised to the -2 power or 10 ^ -2 ).

To multiply a number by 10 raised to a negative power, just move the decimal point to the left by 2.
The result is -.05412 in DOUBLE accuracy.

Example 3: 3.07E+12 is a positive 3.07 times 1,000,000,000,000 (10 raised to the 12 power or 10 ^ 12).

To multiply a number by 10 raised to a positive power, just move the decimal point to the right by 12.
The result is 3,070,000,000,000 in SINGLE accuracy.


See also:



Navigation:
Keyword Reference - Alphabetical
Keyword Reference - By usage
Main WIKI Page