Average Error: 0.2 → 0.0
Time: 13.6s
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(3 + a\right)\right)\right) - 1\]
\[\mathsf{fma}\left(\mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(3 + a\right)\right), 4, {1}^{2} \cdot {\left(\mathsf{hypot}\left(a, b\right)\right)}^{\left(2 + 2\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(3 + a\right)\right)\right) - 1
\mathsf{fma}\left(\mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(3 + a\right)\right), 4, {1}^{2} \cdot {\left(\mathsf{hypot}\left(a, b\right)\right)}^{\left(2 + 2\right)}\right) - 1
double f(double a, double b) {
        double r361126 = a;
        double r361127 = r361126 * r361126;
        double r361128 = b;
        double r361129 = r361128 * r361128;
        double r361130 = r361127 + r361129;
        double r361131 = 2.0;
        double r361132 = pow(r361130, r361131);
        double r361133 = 4.0;
        double r361134 = 1.0;
        double r361135 = r361134 - r361126;
        double r361136 = r361127 * r361135;
        double r361137 = 3.0;
        double r361138 = r361137 + r361126;
        double r361139 = r361129 * r361138;
        double r361140 = r361136 + r361139;
        double r361141 = r361133 * r361140;
        double r361142 = r361132 + r361141;
        double r361143 = r361142 - r361134;
        return r361143;
}

double f(double a, double b) {
        double r361144 = a;
        double r361145 = r361144 * r361144;
        double r361146 = 1.0;
        double r361147 = r361146 - r361144;
        double r361148 = b;
        double r361149 = r361148 * r361148;
        double r361150 = 3.0;
        double r361151 = r361150 + r361144;
        double r361152 = r361149 * r361151;
        double r361153 = fma(r361145, r361147, r361152);
        double r361154 = 4.0;
        double r361155 = 1.0;
        double r361156 = 2.0;
        double r361157 = pow(r361155, r361156);
        double r361158 = hypot(r361144, r361148);
        double r361159 = r361156 + r361156;
        double r361160 = pow(r361158, r361159);
        double r361161 = r361157 * r361160;
        double r361162 = fma(r361153, r361154, r361161);
        double r361163 = r361162 - r361146;
        return r361163;
}

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(3 + a\right)\right)\right) - 1\]
  2. Simplified0.2

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

    \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(3 + a\right)\right), 4, {\color{blue}{\left(\sqrt{\mathsf{fma}\left(a, a, b \cdot b\right)} \cdot \sqrt{\mathsf{fma}\left(a, a, b \cdot b\right)}\right)}}^{2}\right) - 1\]
  5. Applied unpow-prod-down0.2

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

    \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(3 + a\right)\right), 4, \color{blue}{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}} \cdot {\left(\sqrt{\mathsf{fma}\left(a, a, b \cdot b\right)}\right)}^{2}\right) - 1\]
  7. Simplified0.2

    \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(3 + a\right)\right), 4, {\left(\mathsf{hypot}\left(a, b\right)\right)}^{2} \cdot \color{blue}{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}}\right) - 1\]
  8. Using strategy rm
  9. Applied *-un-lft-identity0.2

    \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(3 + a\right)\right), 4, {\color{blue}{\left(1 \cdot \mathsf{hypot}\left(a, b\right)\right)}}^{2} \cdot {\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right) - 1\]
  10. Applied unpow-prod-down0.2

    \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(3 + a\right)\right), 4, \color{blue}{\left({1}^{2} \cdot {\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right)} \cdot {\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right) - 1\]
  11. Applied associate-*l*0.2

    \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(3 + a\right)\right), 4, \color{blue}{{1}^{2} \cdot \left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{2} \cdot {\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right)}\right) - 1\]
  12. Simplified0.0

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

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

Reproduce

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