Commit b428ba5
authored
Relax NaN comparison in compression tests (#2388)
* Relax NaN comparison in compression tests
`compareExact(float)` currently requires bitwise equality, even for
NaN, but C vs C++ EXR can generate NaNs that are not bit-wise
identical, leading to reports of failures on various architectures.
This fixes the failures noted in #1281, #1460, #1628 in
the `test*Compression` tests, of the form:
F float at 59, 0 not equal: C++ loaded C 0x7fc4e364 (nan) vs C loaded C 7f84e364 (nan)
and in `testOptimizedInterleavePatterns`:
error reading back channel B pixel 21,-76 got -nan expected -nan
This change takes the conservative approach and relaxes the bitwise
comparison only for the architectures that are known to have NaN
differences.
This also changes the method of bitwise comparison of float
values. The C++ standard does not guarantee that writing one field of
a union and reading another is well-defined, and we've seen cases of
it failing with Intel's oneAPI. This changes the comparison to use
`memcpy` to a `uint32_t` instead of a union.
Made with Cursor
Signed-off-by: Cary Phillips <cary@ilm.com>
* remove extraneous bothNan
Signed-off-by: Cary Phillips <cary@ilm.com>
* Use test on all architectures
Signed-off-by: Cary Phillips <cary@ilm.com>
---------
Signed-off-by: Cary Phillips <cary@ilm.com>1 parent f21cb81 commit b428ba5
1 file changed
Lines changed: 13 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
519 | 519 | | |
520 | 520 | | |
521 | 521 | | |
522 | | - | |
523 | | - | |
524 | | - | |
525 | | - | |
526 | | - | |
527 | | - | |
528 | | - | |
529 | | - | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
530 | 532 | | |
531 | 533 | | |
532 | | - | |
| 534 | + | |
533 | 535 | | |
534 | | - | |
| 536 | + | |
535 | 537 | | |
536 | 538 | | |
537 | | - | |
| 539 | + | |
538 | 540 | | |
539 | 541 | | |
540 | 542 | | |
| |||
0 commit comments