\frac{\left(1 - x\right) \cdot \left(3 - x\right)}{y \cdot 3}\frac{1 - x}{y \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{3}{3 - x}\right)\right)}double f(double x, double y) {
double r716103 = 1.0;
double r716104 = x;
double r716105 = r716103 - r716104;
double r716106 = 3.0;
double r716107 = r716106 - r716104;
double r716108 = r716105 * r716107;
double r716109 = y;
double r716110 = r716109 * r716106;
double r716111 = r716108 / r716110;
return r716111;
}
double f(double x, double y) {
double r716112 = 1.0;
double r716113 = x;
double r716114 = r716112 - r716113;
double r716115 = y;
double r716116 = 3.0;
double r716117 = r716116 - r716113;
double r716118 = r716116 / r716117;
double r716119 = expm1(r716118);
double r716120 = log1p(r716119);
double r716121 = r716115 * r716120;
double r716122 = r716114 / r716121;
return r716122;
}




Bits error versus x




Bits error versus y
Results
| Original | 5.8 |
|---|---|
| Target | 0.1 |
| Herbie | 0.1 |
Initial program 5.8
rmApplied associate-/l*0.3
Simplified0.1
rmApplied expm1-log1p-u0.1
rmApplied log1p-expm1-u0.1
Simplified0.1
Final simplification0.1
herbie shell --seed 2020042 +o rules:numerics
(FPCore (x y)
:name "Diagrams.TwoD.Arc:bezierFromSweepQ1 from diagrams-lib-1.3.0.3"
:precision binary64
:herbie-target
(* (/ (- 1 x) y) (/ (- 3 x) 3))
(/ (* (- 1 x) (- 3 x)) (* y 3)))