<< ipermute | Elementary functions | iscolumn >> |
res = isapprox(x1, x2) |
res = isapprox(x1, x2, precision) |
a matrix, a sparse matrix of doubles, or a multidimensional matrix.
a matrix, a sparse matrix of doubles, or a multidimensional matrix.
a double value: 0. by default
a logical value
For matrices, the comparison is done using the Hilbert-Schmidt norm (aka Frobenius norm L2 norm).
isapprox manages complex numbers. In this case, the real parts of the input arguments are compared. If this fails, it returns false. If this succeeds, the imaginary parts are compared.
To compare values, NaN, Inf, -Inf and remaining values, are separated. As it is impossible to compare NaN values between them, we compare the indices where NaN value occurs. For infinity values, we also compare the indices where Inf values occurs.
A = pi
B = single(pi)
res = isapprox(A, B)
A = pi
B = single(pi)
res = isapprox(A, B, 1e-4)
A = [pi NaN]
res = isapprox(A, A)
A = [pi NaN]
B = [pi + 2*eps, NaN]
res = isapprox(A, B)
res = isapprox(A, B, eps)
Version | Description |
---|---|
1.0.0 | initial version |
Allan CORNET