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
[0.7012920012119436, 0.7012920012119435]
is empty: true
You can see that the last digit was rounded improperly resulting in an empty interval. If I try the same case but use rounded_transc_exact for the rounding policy It works as expected:
[0.7012920012119437, 0.7012920012119437]
is empty: false
My compiler info is
Apple clang version 11.0.0 (clang-1100.0.33.17)
Target: x86_64-apple-darwin19.3.0
Thread model: posix
and the example is compiled in debug mode. The examples works fine on GCC (specifically I tested on gcc (Ubuntu 9.2.1-9ubuntu2) 9.2.1 20191008)
Debugging some more, I wanted to verify it would work for GCC on my mac. Using g++-9 (Homebrew GCC 9.2.0_3) 9.2.0, I still get the same rounding failure:
[0.7012920012119436, 0.7012920012119435]
is empty: true
Could this be a problem with the hardware implementation of the trignometric functions? Is it guaranteed that FE_DOWNWARD cos(theta) < FE_UPWARD cos(theta)?
I don't think so, #13 was a compilation error if you did not specify the right rounding policy. This error is related to how the trigonometric functions are rounded using hardware rounding. We published a research article benchmarking various C/C++ interval arithmetic libraries. In it we found that the hardware rounding of transcendental functions is broken on certain platforms. We concluded filib to be the overall fastest and reliable library. You can read the full paper here.
Activity
[-]Cosine rounding failure with Clang[/-][+]Cosine rounding failure on macOS[/+]zfergus commentedon Feb 28, 2020
Debugging some more, I wanted to verify it would work for GCC on my mac. Using
g++-9 (Homebrew GCC 9.2.0_3) 9.2.0, I still get the same rounding failure:Could this be a problem with the hardware implementation of the trignometric functions? Is it guaranteed that
FE_DOWNWARDcos(theta) <FE_UPWARDcos(theta)?zfergus commentedon Feb 28, 2020
At this point, I have run it on five different machines:
All compiled with GCC (of different versions ranging from 7 to 9).
jeking3 commentedon Dec 5, 2024
Does this have any relation to #13?
zfergus commentedon Dec 5, 2024
I don't think so, #13 was a compilation error if you did not specify the right rounding policy. This error is related to how the trigonometric functions are rounded using hardware rounding. We published a research article benchmarking various C/C++ interval arithmetic libraries. In it we found that the hardware rounding of transcendental functions is broken on certain platforms. We concluded filib to be the overall fastest and reliable library. You can read the full paper here.