double code(double x, double y, double z, double t) {
return ((double) (((double) (x * 2.0)) / ((double) (((double) (y * z)) - ((double) (t * z))))));
}
double code(double x, double y, double z, double t) {
double VAR;
if ((z <= -19228.415161329853)) {
VAR = ((double) (((double) (x * ((double) (2.0 / z)))) / ((double) (y - t))));
} else {
double VAR_1;
if ((z <= 1586623875675827.2)) {
VAR_1 = ((double) (((double) (x * 2.0)) / ((double) (z * ((double) (y - t))))));
} else {
VAR_1 = ((double) (((double) (x / z)) * ((double) (2.0 / ((double) (y - t))))));
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 6.8 |
|---|---|
| Target | 1.9 |
| Herbie | 1.9 |
if z < -19228.415161329853Initial program 11.1
Simplified9.1
rmApplied associate-/r*8.4
rmApplied associate-*r/1.6
if -19228.415161329853 < z < 1586623875675827.25Initial program 2.0
Simplified2.3
rmApplied associate-*r/2.0
if 1586623875675827.25 < z Initial program 11.3
Simplified9.2
rmApplied *-un-lft-identity9.2
Applied times-frac8.7
Applied associate-*r*2.0
Simplified1.9
Final simplification1.9
herbie shell --seed 2020191
(FPCore (x y z t)
:name "Linear.Projection:infinitePerspective from linear-1.19.1.3, A"
:precision binary64
:herbie-target
(if (< (/ (* x 2.0) (- (* y z) (* t z))) -2.559141628295061e-13) (* (/ x (* (- y t) z)) 2.0) (if (< (/ (* x 2.0) (- (* y z) (* t z))) 1.0450278273301259e-269) (/ (* (/ x z) 2.0) (- y t)) (* (/ x (* (- y t) z)) 2.0)))
(/ (* x 2.0) (- (* y z) (* t z))))