When the numbers are really small, Matlab automatically shows them formatted in Scientific Notation.
Example:
A = rand(3) / 10000000000000000;
A =
1.0e-016 *
0.6340 0.1077 0.6477
0.3012 0.7984 0.0551
0.5830 0.8751 0.9386
Is there some in-built function which returns the exponent? Something like: getExponent(A) = -16?
I know this is sort of a stupid question, but I need to check hundreds of matrices and I can’t seem to figure it out.
Thank you for your help.
Basic math can tell you that:
The log base 10 of a number tells you approximately how many digits before the decimal are in that number.
For instance,
99987123459823754is9.998E+016log10(99987123459823754)is16.9999441, the floor of which is16– which can basically tell you “the exponent in scientific notation is 16, very close to being 17”.Floor always rounds down, so you don’t need to worry about small exponents: