\frac{x \cdot \left(y - z\right)}{y}\begin{array}{l}
\mathbf{if}\;x \le -1.290655561206783908563838071823474030955 \cdot 10^{97}:\\
\;\;\;\;\left(1 - \frac{z}{y}\right) \cdot x\\
\mathbf{elif}\;x \le 2.731727571395544206998641716133386673057 \cdot 10^{-15}:\\
\;\;\;\;x - \frac{x \cdot z}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{y}{y - z}\right)\right)}\\
\end{array}double f(double x, double y, double z) {
double r489335 = x;
double r489336 = y;
double r489337 = z;
double r489338 = r489336 - r489337;
double r489339 = r489335 * r489338;
double r489340 = r489339 / r489336;
return r489340;
}
double f(double x, double y, double z) {
double r489341 = x;
double r489342 = -1.290655561206784e+97;
bool r489343 = r489341 <= r489342;
double r489344 = 1.0;
double r489345 = z;
double r489346 = y;
double r489347 = r489345 / r489346;
double r489348 = r489344 - r489347;
double r489349 = r489348 * r489341;
double r489350 = 2.7317275713955442e-15;
bool r489351 = r489341 <= r489350;
double r489352 = r489341 * r489345;
double r489353 = r489352 / r489346;
double r489354 = r489341 - r489353;
double r489355 = r489346 - r489345;
double r489356 = r489346 / r489355;
double r489357 = expm1(r489356);
double r489358 = log1p(r489357);
double r489359 = r489341 / r489358;
double r489360 = r489351 ? r489354 : r489359;
double r489361 = r489343 ? r489349 : r489360;
return r489361;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.4 |
|---|---|
| Target | 3.3 |
| Herbie | 1.8 |
if x < -1.290655561206784e+97Initial program 31.2
rmApplied associate-/l*0.1
rmApplied clear-num0.2
rmApplied div-inv0.3
Applied add-cube-cbrt0.3
Applied times-frac0.3
Simplified0.2
Simplified0.1
if -1.290655561206784e+97 < x < 2.7317275713955442e-15Initial program 5.6
Taylor expanded around 0 2.7
if 2.7317275713955442e-15 < x Initial program 20.8
rmApplied associate-/l*0.1
rmApplied log1p-expm1-u0.1
Final simplification1.8
herbie shell --seed 2019303 +o rules:numerics
(FPCore (x y z)
:name "Diagrams.Backend.Cairo.Internal:setTexture from diagrams-cairo-1.3.0.3"
:precision binary64
:herbie-target
(if (< z -2.060202331921739e104) (- x (/ (* z x) y)) (if (< z 1.69397660138285259e213) (/ x (/ y (- y z))) (* (- y z) (/ x y))))
(/ (* x (- y z)) y))