You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Returns a boolean scalar where two arrays are element-wise equal within a tolerance, behaves like `all(is_close(a, b [, rel_tol, abs_tol]))`.
471
+
Returns a boolean scalar where two arrays are element-wise equal within a tolerance, behaves like `all(is_close(a, b [, rel_tol, abs_tol, equal_nan]))`.
460
472
461
473
#### Syntax
462
474
463
-
`bool = [[stdlib_math(module):all_close(interface)]] (a, b [, rel_tol, abs_tol])`
475
+
`bool = [[stdlib_math(module):all_close(interface)]] (a, b [, rel_tol, abs_tol, equal_nan])`
464
476
465
477
#### Status
466
478
@@ -484,6 +496,9 @@ This argument is `intent(in)` and `optional`, which is `1.0e-9` by default.
484
496
`abs_tol`: Shall be a `real` scalar.
485
497
This argument is `intent(in)` and `optional`, which is `0.0` by default.
486
498
499
+
`equal_nan`: Shall be a `logical` scalar.
500
+
This argument is `intent(in)` and `optional`, which is `.false.` by default.
501
+
487
502
Note: All `real/complex` arguments must have same `kind`.
488
503
If the value of `rel_tol/abs_tol` is negative (not recommended),
489
504
it will be corrected to `abs(rel_tol/abs_tol)` by the internal process of `all_close`.
@@ -496,18 +511,23 @@ Returns a `logical` scalar.
496
511
497
512
```fortran
498
513
program demo_math_all_close
514
+
499
515
use stdlib_math, only: all_close
500
516
use stdlib_error, only: check
501
-
real :: x(2) = [1, 2], random(4, 4)
517
+
real :: x(2) = [1, 2], y, NAN
502
518
complex :: z(4, 4)
503
519
520
+
y = -3
521
+
NAN = sqrt(y)
522
+
z = (1.0, 1.0)
523
+
524
+
print *, all_close(z+cmplx(1.0e-11, 1.0e-11), z) !! T
0 commit comments