Dear all,
I am trying to understand why I am getting different numerical results with the interval library depending on the optimization level of the compiler.
I am attaching the smallest example I have been able to create:
# On my Mac laptop
Apple LLVM version 9.0.0 (clang-900.0.39.2)
boost 1.66 (installed via homebrew)
$ g++ foo.cpp -o foo
$ ./foo
third1 = 0.333333333333333314829616256247 390992939472198486328125000000 0000
third2 = 0.333333333333333314829616256247 390992939472198486328125000000 0000
v1 = (0.999999999999999888977697537484 345957636833190917968750000000 0000,1. 000000000000000000000000000000 000000000000000000000000000000 0000)
v2 = (0.999999999999999888977697537484 345957636833190917968750000000 0000,1. 000000000000000000000000000000 000000000000000000000000000000 0000)
$ g++ -O2 foo.cpp -o foo
$ ./foo
third1 = 0.333333333333333314829616256247 390992939472198486328125000000 0000
third2 = 0.333333333333333314829616256247 390992939472198486328125000000 0000
v1 = (1.000000000000000000000000000000 000000000000000000000000000000 0000,1. 000000000000000000000000000000 000000000000000000000000000000 0000)
v2 = (1.000000000000000000000000000000 000000000000000000000000000000 0000,1. 000000000000000000000000000000 000000000000000000000000000000 0000)
I would expect to get the same output in both cases, but the lower end-points are different in the second case, and seem wrong to me since third2 * 3.0 < 1.0.
# On my Linux machine the effect is different:
gcc version 5.4.0 20160609
boost 1.58 on Ubuntu 16.04.9
$ g++ foo.cpp -o foo
$ ./foo
third1 = 0.333333333333333314829616256247 390992939472198486328125000000 0000
third2 = 0.333333333333333314829616256247 390992939472198486328125000000 0000
v1 = (0.999999999999999888977697537484 345957636833190917968750000000 0000,1. 000000000000000000000000000000 000000000000000000000000000000 0000)
v2 = (0.999999999999999888977697537484 345957636833190917968750000000 0000,1. 000000000000000000000000000000 000000000000000000000000000000 0000)
$ g++ -O2 foo.cpp -o foo
$ ./foo
third1 = 0.333333333333333314829616256247 390992939472198486328125000000 0000
third2 = 0.333333333333333314829616256247 390992939472198486328125000000 0000
v1 = (0.999999999999999888977697537484 345957636833190917968750000000 0000,1. 000000000000000000000000000000 000000000000000000000000000000 0000)
v2 = (1.000000000000000000000000000000 000000000000000000000000000000 0000,1. 000000000000000000000000000000 000000000000000000000000000000 0000)
Can anyone explain what is going on?
Thanks in advance,
Tim
-- Tim van Erven <tim@timvanerven.nl> www.timvanerven.nl
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
https://lists.boost.org/mailman/listinfo.cgi/boost- users