Average Error: 0.2 → 0.2
Time: 29.2s
Precision: 64
\[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 + a\right) + \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right)\right) - 1\]
\[\sqrt{\mathsf{fma}\left(a \cdot a + b \cdot b, a \cdot a + b \cdot b, 4 \cdot \left(\left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right) + \left(a \cdot a\right) \cdot \left(a + 1\right)\right)\right)} \cdot \left(\sqrt{\sqrt{\mathsf{fma}\left(a \cdot a + b \cdot b, a \cdot a + b \cdot b, 4 \cdot \left(\left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right) + \left(a \cdot a\right) \cdot \left(a + 1\right)\right)\right)}} \cdot \sqrt{\sqrt{\mathsf{fma}\left(a \cdot a + b \cdot b, a \cdot a + b \cdot b, 4 \cdot \left(\left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right) + \left(a \cdot a\right) \cdot \left(a + 1\right)\right)\right)}}\right) - 1\]
\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 + a\right) + \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right)\right) - 1
\sqrt{\mathsf{fma}\left(a \cdot a + b \cdot b, a \cdot a + b \cdot b, 4 \cdot \left(\left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right) + \left(a \cdot a\right) \cdot \left(a + 1\right)\right)\right)} \cdot \left(\sqrt{\sqrt{\mathsf{fma}\left(a \cdot a + b \cdot b, a \cdot a + b \cdot b, 4 \cdot \left(\left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right) + \left(a \cdot a\right) \cdot \left(a + 1\right)\right)\right)}} \cdot \sqrt{\sqrt{\mathsf{fma}\left(a \cdot a + b \cdot b, a \cdot a + b \cdot b, 4 \cdot \left(\left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right) + \left(a \cdot a\right) \cdot \left(a + 1\right)\right)\right)}}\right) - 1
double f(double a, double b) {
        double r6038136 = a;
        double r6038137 = r6038136 * r6038136;
        double r6038138 = b;
        double r6038139 = r6038138 * r6038138;
        double r6038140 = r6038137 + r6038139;
        double r6038141 = 2.0;
        double r6038142 = pow(r6038140, r6038141);
        double r6038143 = 4.0;
        double r6038144 = 1.0;
        double r6038145 = r6038144 + r6038136;
        double r6038146 = r6038137 * r6038145;
        double r6038147 = 3.0;
        double r6038148 = r6038147 * r6038136;
        double r6038149 = r6038144 - r6038148;
        double r6038150 = r6038139 * r6038149;
        double r6038151 = r6038146 + r6038150;
        double r6038152 = r6038143 * r6038151;
        double r6038153 = r6038142 + r6038152;
        double r6038154 = r6038153 - r6038144;
        return r6038154;
}

double f(double a, double b) {
        double r6038155 = a;
        double r6038156 = r6038155 * r6038155;
        double r6038157 = b;
        double r6038158 = r6038157 * r6038157;
        double r6038159 = r6038156 + r6038158;
        double r6038160 = 4.0;
        double r6038161 = 1.0;
        double r6038162 = 3.0;
        double r6038163 = r6038162 * r6038155;
        double r6038164 = r6038161 - r6038163;
        double r6038165 = r6038158 * r6038164;
        double r6038166 = r6038155 + r6038161;
        double r6038167 = r6038156 * r6038166;
        double r6038168 = r6038165 + r6038167;
        double r6038169 = r6038160 * r6038168;
        double r6038170 = fma(r6038159, r6038159, r6038169);
        double r6038171 = sqrt(r6038170);
        double r6038172 = sqrt(r6038171);
        double r6038173 = r6038172 * r6038172;
        double r6038174 = r6038171 * r6038173;
        double r6038175 = r6038174 - r6038161;
        return r6038175;
}

Error

Bits error versus a

Bits error versus b

Derivation

  1. Initial program 0.2

    \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 + a\right) + \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right)\right) - 1\]
  2. Using strategy rm
  3. Applied unpow20.2

    \[\leadsto \left(\color{blue}{\left(a \cdot a + b \cdot b\right) \cdot \left(a \cdot a + b \cdot b\right)} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 + a\right) + \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right)\right) - 1\]
  4. Applied fma-def0.2

    \[\leadsto \color{blue}{\mathsf{fma}\left(a \cdot a + b \cdot b, a \cdot a + b \cdot b, 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 + a\right) + \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right)\right)} - 1\]
  5. Using strategy rm
  6. Applied add-sqr-sqrt0.2

    \[\leadsto \color{blue}{\sqrt{\mathsf{fma}\left(a \cdot a + b \cdot b, a \cdot a + b \cdot b, 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 + a\right) + \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right)\right)} \cdot \sqrt{\mathsf{fma}\left(a \cdot a + b \cdot b, a \cdot a + b \cdot b, 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 + a\right) + \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right)\right)}} - 1\]
  7. Using strategy rm
  8. Applied add-sqr-sqrt0.2

    \[\leadsto \sqrt{\mathsf{fma}\left(a \cdot a + b \cdot b, a \cdot a + b \cdot b, 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 + a\right) + \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right)\right)} \cdot \sqrt{\color{blue}{\sqrt{\mathsf{fma}\left(a \cdot a + b \cdot b, a \cdot a + b \cdot b, 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 + a\right) + \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right)\right)} \cdot \sqrt{\mathsf{fma}\left(a \cdot a + b \cdot b, a \cdot a + b \cdot b, 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 + a\right) + \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right)\right)}}} - 1\]
  9. Applied sqrt-prod0.2

    \[\leadsto \sqrt{\mathsf{fma}\left(a \cdot a + b \cdot b, a \cdot a + b \cdot b, 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 + a\right) + \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right)\right)} \cdot \color{blue}{\left(\sqrt{\sqrt{\mathsf{fma}\left(a \cdot a + b \cdot b, a \cdot a + b \cdot b, 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 + a\right) + \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right)\right)}} \cdot \sqrt{\sqrt{\mathsf{fma}\left(a \cdot a + b \cdot b, a \cdot a + b \cdot b, 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 + a\right) + \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right)\right)}}\right)} - 1\]
  10. Final simplification0.2

    \[\leadsto \sqrt{\mathsf{fma}\left(a \cdot a + b \cdot b, a \cdot a + b \cdot b, 4 \cdot \left(\left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right) + \left(a \cdot a\right) \cdot \left(a + 1\right)\right)\right)} \cdot \left(\sqrt{\sqrt{\mathsf{fma}\left(a \cdot a + b \cdot b, a \cdot a + b \cdot b, 4 \cdot \left(\left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right) + \left(a \cdot a\right) \cdot \left(a + 1\right)\right)\right)}} \cdot \sqrt{\sqrt{\mathsf{fma}\left(a \cdot a + b \cdot b, a \cdot a + b \cdot b, 4 \cdot \left(\left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right) + \left(a \cdot a\right) \cdot \left(a + 1\right)\right)\right)}}\right) - 1\]

Reproduce

herbie shell --seed 2019138 +o rules:numerics
(FPCore (a b)
  :name "Bouland and Aaronson, Equation (25)"
  (- (+ (pow (+ (* a a) (* b b)) 2) (* 4 (+ (* (* a a) (+ 1 a)) (* (* b b) (- 1 (* 3 a)))))) 1))