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 ((((double) (((double) (y * z)) - ((double) (z * t)))) <= -1.4081857819970173e+280)) {
VAR = ((double) (((double) (x * ((double) (2.0 / z)))) / ((double) (y - t))));
} else {
double VAR_1;
if (((((double) (((double) (y * z)) - ((double) (z * t)))) <= -3.639291069457733e-133) || (!(((double) (((double) (y * z)) - ((double) (z * t)))) <= 2.679802493275991e-121) && (((double) (((double) (y * z)) - ((double) (z * t)))) <= 6.238085171129462e+151)))) {
VAR_1 = ((double) (((double) (x * 2.0)) / ((double) (((double) (y * z)) - ((double) (z * t))))));
} else {
VAR_1 = ((double) (((double) (x * ((double) (2.0 / ((double) (y - t)))))) / z));
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 6.7 |
|---|---|
| Target | 2.0 |
| Herbie | 0.9 |
if (- (* y z) (* t z)) < -1.40818578199701733e280Initial program 16.9
Simplified16.9
rmApplied add-sqr-sqrt17.0
Applied times-frac15.8
Applied associate-*r*0.3
rmApplied associate-*r/0.3
Simplified0.1
if -1.40818578199701733e280 < (- (* y z) (* t z)) < -3.63929106945773292e-133 or 2.6798024932759908e-121 < (- (* y z) (* t z)) < 6.23808517112946158e151Initial program 0.3
if -3.63929106945773292e-133 < (- (* y z) (* t z)) < 2.6798024932759908e-121 or 6.23808517112946158e151 < (- (* y z) (* t z)) Initial program 12.6
Simplified10.2
rmApplied *-un-lft-identity10.2
Applied times-frac9.8
Applied associate-*r*2.2
Simplified2.2
rmApplied associate-*l/2.0
Final simplification0.9
herbie shell --seed 2020190
(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))))