Average Error: 0.5 → 0.3
Time: 1.4min
Precision: binary64
\[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
\[\begin{array}{l} t_0 := \mathsf{fma}\left(2, x2, 3 \cdot \left(x1 \cdot x1\right)\right) - x1\\ x1 + \mathsf{fma}\left(3, \frac{x1 \cdot \left(x1 \cdot 3\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, \mathsf{fma}\left(x1, 3 \cdot \left(x1 \cdot \frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}\right), \mathsf{fma}\left(x1, x1, 1\right) \cdot \left(x1 + \left(t_0 \cdot \frac{x1 \cdot \left(2 \cdot \left(\frac{t_0}{\mathsf{fma}\left(x1, x1, 1\right)} + -3\right) + x1 \cdot 4\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + \left(x1 \cdot x1\right) \cdot -6\right)\right)\right)\right) \end{array} \]
x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right)
\begin{array}{l}
t_0 := \mathsf{fma}\left(2, x2, 3 \cdot \left(x1 \cdot x1\right)\right) - x1\\
x1 + \mathsf{fma}\left(3, \frac{x1 \cdot \left(x1 \cdot 3\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, \mathsf{fma}\left(x1, 3 \cdot \left(x1 \cdot \frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}\right), \mathsf{fma}\left(x1, x1, 1\right) \cdot \left(x1 + \left(t_0 \cdot \frac{x1 \cdot \left(2 \cdot \left(\frac{t_0}{\mathsf{fma}\left(x1, x1, 1\right)} + -3\right) + x1 \cdot 4\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + \left(x1 \cdot x1\right) \cdot -6\right)\right)\right)\right)
\end{array}
(FPCore (x1 x2)
 :precision binary64
 (+
  x1
  (+
   (+
    (+
     (+
      (*
       (+
        (*
         (*
          (* 2.0 x1)
          (/ (- (+ (* (* 3.0 x1) x1) (* 2.0 x2)) x1) (+ (* x1 x1) 1.0)))
         (- (/ (- (+ (* (* 3.0 x1) x1) (* 2.0 x2)) x1) (+ (* x1 x1) 1.0)) 3.0))
        (*
         (* x1 x1)
         (-
          (* 4.0 (/ (- (+ (* (* 3.0 x1) x1) (* 2.0 x2)) x1) (+ (* x1 x1) 1.0)))
          6.0)))
       (+ (* x1 x1) 1.0))
      (*
       (* (* 3.0 x1) x1)
       (/ (- (+ (* (* 3.0 x1) x1) (* 2.0 x2)) x1) (+ (* x1 x1) 1.0))))
     (* (* x1 x1) x1))
    x1)
   (* 3.0 (/ (- (- (* (* 3.0 x1) x1) (* 2.0 x2)) x1) (+ (* x1 x1) 1.0))))))
(FPCore (x1 x2)
 :precision binary64
 (let* ((t_0 (- (fma 2.0 x2 (* 3.0 (* x1 x1))) x1)))
   (+
    x1
    (fma
     3.0
     (/ (- (* x1 (* x1 3.0)) (fma 2.0 x2 x1)) (fma x1 x1 1.0))
     (fma
      x1
      (* 3.0 (* x1 (/ (- (fma x1 (* x1 3.0) (* 2.0 x2)) x1) (fma x1 x1 1.0))))
      (*
       (fma x1 x1 1.0)
       (+
        x1
        (+
         (*
          t_0
          (/
           (* x1 (+ (* 2.0 (+ (/ t_0 (fma x1 x1 1.0)) -3.0)) (* x1 4.0)))
           (fma x1 x1 1.0)))
         (* (* x1 x1) -6.0)))))))))
double code(double x1, double x2) {
	return x1 + (((((((((2.0 * x1) * (((((3.0 * x1) * x1) + (2.0 * x2)) - x1) / ((x1 * x1) + 1.0))) * ((((((3.0 * x1) * x1) + (2.0 * x2)) - x1) / ((x1 * x1) + 1.0)) - 3.0)) + ((x1 * x1) * ((4.0 * (((((3.0 * x1) * x1) + (2.0 * x2)) - x1) / ((x1 * x1) + 1.0))) - 6.0))) * ((x1 * x1) + 1.0)) + (((3.0 * x1) * x1) * (((((3.0 * x1) * x1) + (2.0 * x2)) - x1) / ((x1 * x1) + 1.0)))) + ((x1 * x1) * x1)) + x1) + (3.0 * (((((3.0 * x1) * x1) - (2.0 * x2)) - x1) / ((x1 * x1) + 1.0))));
}
double code(double x1, double x2) {
	double t_0 = fma(2.0, x2, (3.0 * (x1 * x1))) - x1;
	return x1 + fma(3.0, (((x1 * (x1 * 3.0)) - fma(2.0, x2, x1)) / fma(x1, x1, 1.0)), fma(x1, (3.0 * (x1 * ((fma(x1, (x1 * 3.0), (2.0 * x2)) - x1) / fma(x1, x1, 1.0)))), (fma(x1, x1, 1.0) * (x1 + ((t_0 * ((x1 * ((2.0 * ((t_0 / fma(x1, x1, 1.0)) + -3.0)) + (x1 * 4.0))) / fma(x1, x1, 1.0))) + ((x1 * x1) * -6.0))))));
}

Error

Bits error versus x1

Bits error versus x2

Derivation

  1. Initial program 0.5

    \[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
  2. Simplified0.3

    \[\leadsto \color{blue}{x1 + \mathsf{fma}\left(3, \frac{x1 \cdot \left(x1 \cdot 3\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, \mathsf{fma}\left(x1, 3 \cdot \left(x1 \cdot \frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}\right), \mathsf{fma}\left(x1, x1, 1\right) \cdot \left(\left(\frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)} \cdot \left(\left(x1 + x1\right) \cdot \left(\frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)} - 3\right) + \left(x1 \cdot x1\right) \cdot 4\right) + \left(x1 \cdot x1\right) \cdot -6\right) + x1\right)\right)\right)} \]
  3. Applied associate-*l/_binary640.3

    \[\leadsto x1 + \mathsf{fma}\left(3, \frac{x1 \cdot \left(x1 \cdot 3\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, \mathsf{fma}\left(x1, 3 \cdot \left(x1 \cdot \frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}\right), \mathsf{fma}\left(x1, x1, 1\right) \cdot \left(\left(\color{blue}{\frac{\left(\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1\right) \cdot \left(\left(x1 + x1\right) \cdot \left(\frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)} - 3\right) + \left(x1 \cdot x1\right) \cdot 4\right)}{\mathsf{fma}\left(x1, x1, 1\right)}} + \left(x1 \cdot x1\right) \cdot -6\right) + x1\right)\right)\right) \]
  4. Simplified0.3

    \[\leadsto x1 + \mathsf{fma}\left(3, \frac{x1 \cdot \left(x1 \cdot 3\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, \mathsf{fma}\left(x1, 3 \cdot \left(x1 \cdot \frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}\right), \mathsf{fma}\left(x1, x1, 1\right) \cdot \left(\left(\frac{\color{blue}{\left(\mathsf{fma}\left(2, x2, 3 \cdot \left(x1 \cdot x1\right)\right) - x1\right) \cdot \mathsf{fma}\left(x1, x1 \cdot 4, \left(\frac{\mathsf{fma}\left(2, x2, 3 \cdot \left(x1 \cdot x1\right)\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)} + -3\right) \cdot \left(x1 + x1\right)\right)}}{\mathsf{fma}\left(x1, x1, 1\right)} + \left(x1 \cdot x1\right) \cdot -6\right) + x1\right)\right)\right) \]
  5. Applied *-un-lft-identity_binary640.3

    \[\leadsto x1 + \mathsf{fma}\left(3, \frac{x1 \cdot \left(x1 \cdot 3\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, \mathsf{fma}\left(x1, 3 \cdot \left(x1 \cdot \frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}\right), \mathsf{fma}\left(x1, x1, 1\right) \cdot \left(\left(\frac{\left(\mathsf{fma}\left(2, x2, 3 \cdot \left(x1 \cdot x1\right)\right) - x1\right) \cdot \mathsf{fma}\left(x1, x1 \cdot 4, \left(\frac{\mathsf{fma}\left(2, x2, 3 \cdot \left(x1 \cdot x1\right)\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)} + -3\right) \cdot \left(x1 + x1\right)\right)}{\color{blue}{1 \cdot \mathsf{fma}\left(x1, x1, 1\right)}} + \left(x1 \cdot x1\right) \cdot -6\right) + x1\right)\right)\right) \]
  6. Applied times-frac_binary640.3

    \[\leadsto x1 + \mathsf{fma}\left(3, \frac{x1 \cdot \left(x1 \cdot 3\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, \mathsf{fma}\left(x1, 3 \cdot \left(x1 \cdot \frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}\right), \mathsf{fma}\left(x1, x1, 1\right) \cdot \left(\left(\color{blue}{\frac{\mathsf{fma}\left(2, x2, 3 \cdot \left(x1 \cdot x1\right)\right) - x1}{1} \cdot \frac{\mathsf{fma}\left(x1, x1 \cdot 4, \left(\frac{\mathsf{fma}\left(2, x2, 3 \cdot \left(x1 \cdot x1\right)\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)} + -3\right) \cdot \left(x1 + x1\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)}} + \left(x1 \cdot x1\right) \cdot -6\right) + x1\right)\right)\right) \]
  7. Applied fma-def_binary640.3

    \[\leadsto x1 + \mathsf{fma}\left(3, \frac{x1 \cdot \left(x1 \cdot 3\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, \mathsf{fma}\left(x1, 3 \cdot \left(x1 \cdot \frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}\right), \mathsf{fma}\left(x1, x1, 1\right) \cdot \left(\color{blue}{\mathsf{fma}\left(\frac{\mathsf{fma}\left(2, x2, 3 \cdot \left(x1 \cdot x1\right)\right) - x1}{1}, \frac{\mathsf{fma}\left(x1, x1 \cdot 4, \left(\frac{\mathsf{fma}\left(2, x2, 3 \cdot \left(x1 \cdot x1\right)\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)} + -3\right) \cdot \left(x1 + x1\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, \left(x1 \cdot x1\right) \cdot -6\right)} + x1\right)\right)\right) \]
  8. Applied fma-udef_binary640.3

    \[\leadsto x1 + \mathsf{fma}\left(3, \frac{x1 \cdot \left(x1 \cdot 3\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, \mathsf{fma}\left(x1, 3 \cdot \left(x1 \cdot \frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}\right), \mathsf{fma}\left(x1, x1, 1\right) \cdot \left(\color{blue}{\left(\frac{\mathsf{fma}\left(2, x2, 3 \cdot \left(x1 \cdot x1\right)\right) - x1}{1} \cdot \frac{\mathsf{fma}\left(x1, x1 \cdot 4, \left(\frac{\mathsf{fma}\left(2, x2, 3 \cdot \left(x1 \cdot x1\right)\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)} + -3\right) \cdot \left(x1 + x1\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + \left(x1 \cdot x1\right) \cdot -6\right)} + x1\right)\right)\right) \]
  9. Simplified0.3

    \[\leadsto x1 + \mathsf{fma}\left(3, \frac{x1 \cdot \left(x1 \cdot 3\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, \mathsf{fma}\left(x1, 3 \cdot \left(x1 \cdot \frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}\right), \mathsf{fma}\left(x1, x1, 1\right) \cdot \left(\left(\color{blue}{\left(\mathsf{fma}\left(2, x2, 3 \cdot \left(x1 \cdot x1\right)\right) - x1\right) \cdot \frac{x1 \cdot \left(\left(\frac{\mathsf{fma}\left(2, x2, 3 \cdot \left(x1 \cdot x1\right)\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)} + -3\right) \cdot 2 + x1 \cdot 4\right)}{\mathsf{fma}\left(x1, x1, 1\right)}} + \left(x1 \cdot x1\right) \cdot -6\right) + x1\right)\right)\right) \]
  10. Final simplification0.3

    \[\leadsto x1 + \mathsf{fma}\left(3, \frac{x1 \cdot \left(x1 \cdot 3\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, \mathsf{fma}\left(x1, 3 \cdot \left(x1 \cdot \frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}\right), \mathsf{fma}\left(x1, x1, 1\right) \cdot \left(x1 + \left(\left(\mathsf{fma}\left(2, x2, 3 \cdot \left(x1 \cdot x1\right)\right) - x1\right) \cdot \frac{x1 \cdot \left(2 \cdot \left(\frac{\mathsf{fma}\left(2, x2, 3 \cdot \left(x1 \cdot x1\right)\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)} + -3\right) + x1 \cdot 4\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + \left(x1 \cdot x1\right) \cdot -6\right)\right)\right)\right) \]

Reproduce

herbie shell --seed 2022076 
(FPCore (x1 x2)
  :name "Rosa's FloatVsDoubleBenchmark"
  :precision binary64
  (+ x1 (+ (+ (+ (+ (* (+ (* (* (* 2.0 x1) (/ (- (+ (* (* 3.0 x1) x1) (* 2.0 x2)) x1) (+ (* x1 x1) 1.0))) (- (/ (- (+ (* (* 3.0 x1) x1) (* 2.0 x2)) x1) (+ (* x1 x1) 1.0)) 3.0)) (* (* x1 x1) (- (* 4.0 (/ (- (+ (* (* 3.0 x1) x1) (* 2.0 x2)) x1) (+ (* x1 x1) 1.0))) 6.0))) (+ (* x1 x1) 1.0)) (* (* (* 3.0 x1) x1) (/ (- (+ (* (* 3.0 x1) x1) (* 2.0 x2)) x1) (+ (* x1 x1) 1.0)))) (* (* x1 x1) x1)) x1) (* 3.0 (/ (- (- (* (* 3.0 x1) x1) (* 2.0 x2)) x1) (+ (* x1 x1) 1.0))))))