Repository: opencv
Issue: Core/HasNonZeroLimitValues.hasNonZeroLimitValues fails with ENABLE_FAST_MATH option
Labels: bug,optimization,category: core

### System Information

OpenCV: current 4.x (4.8.0-dev)
Platform: Ubuntu 18.04, GCC 7.5
Hardware: Core i5 2500k (no avx2 and no avx512)

### Detailed description

Failed test case:
```
    m.setTo((CV_MAT_DEPTH(type) == CV_64F) ? Scalar::all(std::numeric_limits<double>::denorm_min()) : Scalar::all(std::numeric_limits<float>::denorm_min()));
    EXPECT_TRUE(hasNonZero(m));
```

### Steps to reproduce

```
cmake -DENABLE_FAST_MATH=1 ../opencv
make -j4
./bin/opencv_test_core --gtest_filter=Core/HasNonZeroLimitValues.hasNonZeroLimitValues/*
```

Log:
```
[----------] 8 tests from Core/HasNonZeroLimitValues
[ RUN      ] Core/HasNonZeroLimitValues.hasNonZeroLimitValues/0, where GetParam() = (5, 1x1)
/home/alexander/Projects/OpenCV/opencv-master/modules/core/test/test_hasnonzero.cpp:109: Failure
Value of: hasNonZero(m)
  Actual: false
Expected: true
[  FAILED  ] Core/HasNonZeroLimitValues.hasNonZeroLimitValues/0, where GetParam() = (5, 1x1) (0 ms)
[ RUN      ] Core/HasNonZeroLimitValues.hasNonZeroLimitValues/1, where GetParam() = (5, 320x240)
/home/alexander/Projects/OpenCV/opencv-master/modules/core/test/test_hasnonzero.cpp:109: Failure
Value of: hasNonZero(m)
  Actual: false
Expected: true
[  FAILED  ] Core/HasNonZeroLimitValues.hasNonZeroLimitValues/1, where GetParam() = (5, 320x240) (0 ms)
[ RUN      ] Core/HasNonZeroLimitValues.hasNonZeroLimitValues/2, where GetParam() = (5, 127x113)
/home/alexander/Projects/OpenCV/opencv-master/modules/core/test/test_hasnonzero.cpp:109: Failure
Value of: hasNonZero(m)
  Actual: false
Expected: true
[  FAILED  ] Core/HasNonZeroLimitValues.hasNonZeroLimitValues/2, where GetParam() = (5, 127x113) (0 ms)
[ RUN      ] Core/HasNonZeroLimitValues.hasNonZeroLimitValues/3, where GetParam() = (5, 1x113)
/home/alexander/Projects/OpenCV/opencv-master/modules/core/test/test_hasnonzero.cpp:109: Failure
Value of: hasNonZero(m)
  Actual: false
Expected: true
[  FAILED  ] Core/HasNonZeroLimitValues.hasNonZeroLimitValues/3, where GetParam() = (5, 1x113) (0 ms)
[ RUN      ] Core/HasNonZeroLimitValues.hasNonZeroLimitValues/4, where GetParam() = (6, 1x1)
/home/alexander/Projects/OpenCV/opencv-master/modules/core/test/test_hasnonzero.cpp:109: Failure
Value of: hasNonZero(m)
  Actual: false
Expected: true
[  FAILED  ] Core/HasNonZeroLimitValues.hasNonZeroLimitValues/4, where GetParam() = (6, 1x1) (0 ms)
[ RUN      ] Core/HasNonZeroLimitValues.hasNonZeroLimitValues/5, where GetParam() = (6, 320x240)
/home/alexander/Projects/OpenCV/opencv-master/modules/core/test/test_hasnonzero.cpp:109: Failure
Value of: hasNonZero(m)
  Actual: false
Expected: true
[  FAILED  ] Core/HasNonZeroLimitValues.hasNonZeroLimitValues/5, where GetParam() = (6, 320x240) (1 ms)
[ RUN      ] Core/HasNonZeroLimitValues.hasNonZeroLimitValues/6, where GetParam() = (6, 127x113)
[       OK ] Core/HasNonZeroLimitValues.hasNonZeroLimitValues/6 (0 ms)
[ RUN      ] Core/HasNonZeroLimitValues.hasNonZeroLimitValues/7, where GetParam() = (6, 1x113)
[       OK ] Core/HasNonZeroLimitValues.hasNonZeroLimitValues/7 (0 ms)
[----------] 8 tests from Core/HasNonZeroLimitValues (1 ms total)

[----------] Global test environment tear-down
[==========] 8 tests from 1 test case ran. (1 ms total)
[  PASSED  ] 2 tests.
[  FAILED  ] 6 tests, listed below:
[  FAILED  ] Core/HasNonZeroLimitValues.hasNonZeroLimitValues/0, where GetParam() = (5, 1x1)
[  FAILED  ] Core/HasNonZeroLimitValues.hasNonZeroLimitValues/1, where GetParam() = (5, 320x240)
[  FAILED  ] Core/HasNonZeroLimitValues.hasNonZeroLimitValues/2, where GetParam() = (5, 127x113)
[  FAILED  ] Core/HasNonZeroLimitValues.hasNonZeroLimitValues/3, where GetParam() = (5, 1x113)
[  FAILED  ] Core/HasNonZeroLimitValues.hasNonZeroLimitValues/4, where GetParam() = (6, 1x1)
[  FAILED  ] Core/HasNonZeroLimitValues.hasNonZeroLimitValues/5, where GetParam() = (6, 320x240)
```

Related to https://github.com/opencv/opencv/pull/22947

### Issue submission checklist

- [X] I report the issue, it's not a question
- [X] I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
- [X] I updated to the latest OpenCV version and the issue is still there
- [X] There is reproducer code and related data files (videos, images, onnx, etc)