Average Error: 0.2 → 0.2
Time: 10.9s
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(4, \mathsf{fma}\left(a \cdot a, 1 + a, \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right), {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right)} \cdot \sqrt{\mathsf{fma}\left(4, \mathsf{fma}\left(a \cdot a, 1 + a, \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right), {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\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(4, \mathsf{fma}\left(a \cdot a, 1 + a, \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right), {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right)} \cdot \sqrt{\mathsf{fma}\left(4, \mathsf{fma}\left(a \cdot a, 1 + a, \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right), {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right)} - 1
double f(double a, double b) {
        double r514974 = a;
        double r514975 = r514974 * r514974;
        double r514976 = b;
        double r514977 = r514976 * r514976;
        double r514978 = r514975 + r514977;
        double r514979 = 2.0;
        double r514980 = pow(r514978, r514979);
        double r514981 = 4.0;
        double r514982 = 1.0;
        double r514983 = r514982 + r514974;
        double r514984 = r514975 * r514983;
        double r514985 = 3.0;
        double r514986 = r514985 * r514974;
        double r514987 = r514982 - r514986;
        double r514988 = r514977 * r514987;
        double r514989 = r514984 + r514988;
        double r514990 = r514981 * r514989;
        double r514991 = r514980 + r514990;
        double r514992 = r514991 - r514982;
        return r514992;
}

double f(double a, double b) {
        double r514993 = 4.0;
        double r514994 = a;
        double r514995 = r514994 * r514994;
        double r514996 = 1.0;
        double r514997 = r514996 + r514994;
        double r514998 = b;
        double r514999 = r514998 * r514998;
        double r515000 = 3.0;
        double r515001 = r515000 * r514994;
        double r515002 = r514996 - r515001;
        double r515003 = r514999 * r515002;
        double r515004 = fma(r514995, r514997, r515003);
        double r515005 = fma(r514994, r514994, r514999);
        double r515006 = 2.0;
        double r515007 = pow(r515005, r515006);
        double r515008 = fma(r514993, r515004, r515007);
        double r515009 = sqrt(r515008);
        double r515010 = r515009 * r515009;
        double r515011 = r515010 - r514996;
        return r515011;
}

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. Simplified0.2

    \[\leadsto \color{blue}{\mathsf{fma}\left(4, \mathsf{fma}\left(a \cdot a, 1 + a, \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right), {\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 \color{blue}{\sqrt{\mathsf{fma}\left(4, \mathsf{fma}\left(a \cdot a, 1 + a, \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right), {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right)} \cdot \sqrt{\mathsf{fma}\left(4, \mathsf{fma}\left(a \cdot a, 1 + a, \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right), {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right)}} - 1\]
  5. Final simplification0.2

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

Reproduce

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