\frac{x \cdot 2}{y \cdot z - t \cdot z}\begin{array}{l}
\mathbf{if}\;z \le -6.694063912547288218817191837339691890919 \cdot 10^{-98}:\\
\;\;\;\;\frac{\frac{x}{z}}{\frac{y - t}{2}}\\
\mathbf{elif}\;z \le 3167.128584297215184051310643553733825684:\\
\;\;\;\;\frac{x}{z \cdot \frac{y - t}{2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{\frac{y - t}{2}}}{z}\\
\end{array}double f(double x, double y, double z, double t) {
double r523505 = x;
double r523506 = 2.0;
double r523507 = r523505 * r523506;
double r523508 = y;
double r523509 = z;
double r523510 = r523508 * r523509;
double r523511 = t;
double r523512 = r523511 * r523509;
double r523513 = r523510 - r523512;
double r523514 = r523507 / r523513;
return r523514;
}
double f(double x, double y, double z, double t) {
double r523515 = z;
double r523516 = -6.694063912547288e-98;
bool r523517 = r523515 <= r523516;
double r523518 = x;
double r523519 = r523518 / r523515;
double r523520 = y;
double r523521 = t;
double r523522 = r523520 - r523521;
double r523523 = 2.0;
double r523524 = r523522 / r523523;
double r523525 = r523519 / r523524;
double r523526 = 3167.128584297215;
bool r523527 = r523515 <= r523526;
double r523528 = r523515 * r523524;
double r523529 = r523518 / r523528;
double r523530 = r523518 / r523524;
double r523531 = r523530 / r523515;
double r523532 = r523527 ? r523529 : r523531;
double r523533 = r523517 ? r523525 : r523532;
return r523533;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 6.6 |
|---|---|
| Target | 2.0 |
| Herbie | 2.3 |
if z < -6.694063912547288e-98Initial program 8.1
Simplified6.9
rmApplied *-un-lft-identity6.9
Applied times-frac6.9
Applied associate-/r*2.3
Simplified2.3
if -6.694063912547288e-98 < z < 3167.128584297215Initial program 2.3
Simplified2.3
rmApplied *-un-lft-identity2.3
Applied times-frac2.3
Applied *-un-lft-identity2.3
Applied times-frac10.2
Simplified10.2
rmApplied associate-*l/10.1
Simplified10.1
rmApplied div-inv10.2
Applied associate-/l*2.4
Simplified2.3
if 3167.128584297215 < z Initial program 10.3
Simplified8.4
rmApplied *-un-lft-identity8.4
Applied times-frac8.4
Applied *-un-lft-identity8.4
Applied times-frac2.2
Simplified2.2
rmApplied associate-*l/2.2
Simplified2.2
Final simplification2.3
herbie shell --seed 2019322
(FPCore (x y z t)
:name "Linear.Projection:infinitePerspective from linear-1.19.1.3, A"
:precision binary64
:herbie-target
(if (< (/ (* x 2) (- (* y z) (* t z))) -2.559141628295061e-13) (* (/ x (* (- y t) z)) 2) (if (< (/ (* x 2) (- (* y z) (* t z))) 1.045027827330126e-269) (/ (* (/ x z) 2) (- y t)) (* (/ x (* (- y t) z)) 2)))
(/ (* x 2) (- (* y z) (* t z))))