\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\left(x + y\right) \cdot \left(\frac{x}{\mathsf{hypot}\left(y, x\right)} \cdot \left(\frac{x}{\mathsf{hypot}\left(y, x\right)} \cdot \frac{x}{\mathsf{hypot}\left(y, x\right)}\right) - \frac{y}{\mathsf{hypot}\left(y, x\right)} \cdot \left(\frac{y}{\mathsf{hypot}\left(y, x\right)} \cdot \frac{y}{\mathsf{hypot}\left(y, x\right)}\right)\right)}{\left(\left(\frac{y}{\mathsf{hypot}\left(y, x\right)} \cdot \frac{x}{\mathsf{hypot}\left(y, x\right)} + \frac{y}{\mathsf{hypot}\left(y, x\right)} \cdot \frac{y}{\mathsf{hypot}\left(y, x\right)}\right) + \frac{x}{\mathsf{hypot}\left(y, x\right)} \cdot \frac{x}{\mathsf{hypot}\left(y, x\right)}\right) \cdot \mathsf{hypot}\left(y, x\right)}\right)\right)double f(double x, double y) {
double r4105128 = x;
double r4105129 = y;
double r4105130 = r4105128 - r4105129;
double r4105131 = r4105128 + r4105129;
double r4105132 = r4105130 * r4105131;
double r4105133 = r4105128 * r4105128;
double r4105134 = r4105129 * r4105129;
double r4105135 = r4105133 + r4105134;
double r4105136 = r4105132 / r4105135;
return r4105136;
}
double f(double x, double y) {
double r4105137 = x;
double r4105138 = y;
double r4105139 = r4105137 + r4105138;
double r4105140 = hypot(r4105138, r4105137);
double r4105141 = r4105137 / r4105140;
double r4105142 = r4105141 * r4105141;
double r4105143 = r4105141 * r4105142;
double r4105144 = r4105138 / r4105140;
double r4105145 = r4105144 * r4105144;
double r4105146 = r4105144 * r4105145;
double r4105147 = r4105143 - r4105146;
double r4105148 = r4105139 * r4105147;
double r4105149 = r4105144 * r4105141;
double r4105150 = r4105149 + r4105145;
double r4105151 = r4105150 + r4105142;
double r4105152 = r4105151 * r4105140;
double r4105153 = r4105148 / r4105152;
double r4105154 = expm1(r4105153);
double r4105155 = log1p(r4105154);
return r4105155;
}




Bits error versus x




Bits error versus y
Results
| Original | 20.5 |
|---|---|
| Target | 0.0 |
| Herbie | 0.0 |
Initial program 20.5
Simplified20.5
rmApplied add-sqr-sqrt20.5
rmApplied log1p-expm1-u20.5
Simplified0.0
rmApplied div-sub0.0
rmApplied flip3--0.0
Applied frac-times0.0
Simplified0.0
Final simplification0.0
herbie shell --seed 2019168 +o rules:numerics
(FPCore (x y)
:name "Kahan p9 Example"
:pre (and (< 0.0 x 1.0) (< y 1.0))
:herbie-target
(if (< 0.5 (fabs (/ x y)) 2.0) (/ (* (- x y) (+ x y)) (+ (* x x) (* y y))) (- 1.0 (/ 2.0 (+ 1.0 (* (/ x y) (/ x y))))))
(/ (* (- x y) (+ x y)) (+ (* x x) (* y y))))