matlab - How to tell if two numbers are really different or they are actually the same due to floating point error -
for example,
0.168033639538270
, 0.168033639538270
are 2 double
type numbers 2 different calculations (some further calculations eigenvalues of matrix).
but treated different matlab (by unique
or ==
). how know if matlab treats them different due floating point error eps = 2.220446049250313e-16
, or if different (the digits behind first 15 digits not same, matlab not display them). matlab treats 2 number same display value same, different, want know if different.
you can print formatted version of number @ required precision using sprintf
, , compare 2 strings using strcmp
.
Comments
Post a Comment