I have a high-precision ODE (ordinary differential equations) solver written on C++. I do all calculations with user-defined type real_type
. There is a typedef declaring this type in the header:
typedef long double real_type;
I decided to change long double type to __float128
for more accuracy. In addition to this I included quadmath.h
and replaced all standard math functions by ones from libquadmath.
If "long double" version is builded without any optimization flags, some reference ODE is solved in 77 seconds. If this version is builded with -O3 flag, the same ODE is solved in 25 seconds. Thus -O3 flag speeds up calculations in three times.
But in "__float 128" version builded without flags similar ODE is solved in 190 seconds, and with -O3 in 160 seconds (~ 15% difference). Why -O3 optimization does such a weak effect for quadruple precision calculations? Maybe I should use other compiler flags or include other libraries?