3.5) Number Representations
- Matlab uses a conventional decimal notation, with an optional decimal point and leading plus or minus sign, for numbers:
- Scientific notation uses the letter e to specify a power of ten scale factor:
- Imaginary numbers use either i or j as a suffix:
- All numbers are stored internally using the long format specified by the IEEE floating point standard. Floating point numbers have a finite precision of roughly 16 significant decimal digits and a finite range of roughly -10E+308 to 10E+308.
- Note that when Matlab prints the values of numerical variables to screen it uses 5 significant figures and scientific notation. This is just to make it easily readable
- Matlab performs all computations in double precision. The format command described below switches among different display formats.
1 -9 +9.0 0.001 99.098765
2.0e-03 1.07e23 -1.732e+03
1i -3.1415j 3e5i
Command | Result | Example |
format | default | 3.1416 |
format short | 5 digit scaled fixed point | 3.1416 |
format long | 15 digit scaled fixed point | 3.14159265358979 |
format short e | 5 digit floating point | 3.1416E+00 |
format long 3 | 15 digit floating point | 3.14159265358979E+00 |