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)\mathsf{fma}\left(\frac{3}{\mathsf{fma}\left(x1, x1, 1\right)}, \mathsf{fma}\left(3, x1 \cdot x1, -\mathsf{fma}\left(x2, 2, x1\right)\right), \left(x1 + \frac{\mathsf{fma}\left(3, x1 \cdot x1, 2 \cdot x2 - x1\right) \cdot \left(\left(3 \cdot x1\right) \cdot x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}\right) + \mathsf{fma}\left(\mathsf{fma}\left(\left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) \cdot 2, \frac{x1 \cdot \mathsf{fma}\left(3, x1 \cdot x1, 2 \cdot x2 - x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 \cdot \mathsf{fma}\left(x1, \frac{\mathsf{fma}\left(3, x1 \cdot x1, 2 \cdot x2 - x1\right) \cdot 4}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 \cdot \left(-6\right)\right)\right), \mathsf{fma}\left(x1, x1, 1\right), \mathsf{fma}\left(x1, x1 \cdot x1, x1\right)\right)\right)double code(double x1, double x2) {
return ((double) (x1 + ((double) (((double) (((double) (((double) (((double) (((double) (((double) (((double) (((double) (2.0 * x1)) * ((double) (((double) (((double) (((double) (((double) (3.0 * x1)) * x1)) + ((double) (2.0 * x2)))) - x1)) / ((double) (((double) (x1 * x1)) + 1.0)))))) * ((double) (((double) (((double) (((double) (((double) (((double) (3.0 * x1)) * x1)) + ((double) (2.0 * x2)))) - x1)) / ((double) (((double) (x1 * x1)) + 1.0)))) - 3.0)))) + ((double) (((double) (x1 * x1)) * ((double) (((double) (4.0 * ((double) (((double) (((double) (((double) (((double) (3.0 * x1)) * x1)) + ((double) (2.0 * x2)))) - x1)) / ((double) (((double) (x1 * x1)) + 1.0)))))) - 6.0)))))) * ((double) (((double) (x1 * x1)) + 1.0)))) + ((double) (((double) (((double) (3.0 * x1)) * x1)) * ((double) (((double) (((double) (((double) (((double) (3.0 * x1)) * x1)) + ((double) (2.0 * x2)))) - x1)) / ((double) (((double) (x1 * x1)) + 1.0)))))))) + ((double) (((double) (x1 * x1)) * x1)))) + x1)) + ((double) (3.0 * ((double) (((double) (((double) (((double) (((double) (3.0 * x1)) * x1)) - ((double) (2.0 * x2)))) - x1)) / ((double) (((double) (x1 * x1)) + 1.0))))))))));
}
double code(double x1, double x2) {
return ((double) fma(((double) (3.0 / ((double) fma(x1, x1, 1.0)))), ((double) fma(3.0, ((double) (x1 * x1)), ((double) -(((double) fma(x2, 2.0, x1)))))), ((double) (((double) (x1 + ((double) (((double) (((double) fma(3.0, ((double) (x1 * x1)), ((double) (((double) (2.0 * x2)) - x1)))) * ((double) (((double) (3.0 * x1)) * x1)))) / ((double) fma(x1, x1, 1.0)))))) + ((double) fma(((double) fma(((double) (((double) (((double) (((double) (((double) (((double) (((double) (3.0 * x1)) * x1)) + ((double) (2.0 * x2)))) - x1)) / ((double) (((double) (x1 * x1)) + 1.0)))) - 3.0)) * 2.0)), ((double) (((double) (x1 * ((double) fma(3.0, ((double) (x1 * x1)), ((double) (((double) (2.0 * x2)) - x1)))))) / ((double) fma(x1, x1, 1.0)))), ((double) (x1 * ((double) fma(x1, ((double) (((double) (((double) fma(3.0, ((double) (x1 * x1)), ((double) (((double) (2.0 * x2)) - x1)))) * 4.0)) / ((double) fma(x1, x1, 1.0)))), ((double) (x1 * ((double) -(6.0)))))))))), ((double) fma(x1, x1, 1.0)), ((double) fma(x1, ((double) (x1 * x1)), x1))))))));
}



Bits error versus x1



Bits error versus x2
Results
Initial program 0.5
Simplified0.3
rmApplied associate-*l*0.3
Simplified0.3
Final simplification0.3
herbie shell --seed 2020123 +o rules:numerics
(FPCore (x1 x2)
:name "Rosa's FloatVsDoubleBenchmark"
:precision binary64
(+ x1 (+ (+ (+ (+ (* (+ (* (* (* 2 x1) (/ (- (+ (* (* 3 x1) x1) (* 2 x2)) x1) (+ (* x1 x1) 1))) (- (/ (- (+ (* (* 3 x1) x1) (* 2 x2)) x1) (+ (* x1 x1) 1)) 3)) (* (* x1 x1) (- (* 4 (/ (- (+ (* (* 3 x1) x1) (* 2 x2)) x1) (+ (* x1 x1) 1))) 6))) (+ (* x1 x1) 1)) (* (* (* 3 x1) x1) (/ (- (+ (* (* 3 x1) x1) (* 2 x2)) x1) (+ (* x1 x1) 1)))) (* (* x1 x1) x1)) x1) (* 3 (/ (- (- (* (* 3 x1) x1) (* 2 x2)) x1) (+ (* x1 x1) 1))))))