x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\begin{array}{l}
\mathbf{if}\;x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t} \leq -9.167360412588197 \cdot 10^{-295}:\\
\;\;\;\;x + \frac{y - x}{\frac{a - t}{z - t}}\\
\mathbf{elif}\;x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t} \leq 0:\\
\;\;\;\;\left(\left(y \cdot \frac{a}{t} + \left(y + \frac{x \cdot z}{t}\right)\right) + \frac{a}{t} \cdot \frac{x \cdot z}{t}\right) - \left(\left(y \cdot \frac{z}{t} + x \cdot \frac{a}{t}\right) + \frac{a}{t} \cdot \left(y \cdot \frac{z}{t}\right)\right)\\
\mathbf{elif}\;x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t} \leq 2.283615310228694 \cdot 10^{+305}:\\
\;\;\;\;x + \left(\left(y - x\right) \cdot \left(z - t\right)\right) \cdot \frac{1}{a - t}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(\frac{z}{a - t} - \frac{t}{a - t}\right)\\
\end{array}(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y x) (- z t)) (- a t))))
(FPCore (x y z t a)
:precision binary64
(if (<= (+ x (/ (* (- y x) (- z t)) (- a t))) -9.167360412588197e-295)
(+ x (/ (- y x) (/ (- a t) (- z t))))
(if (<= (+ x (/ (* (- y x) (- z t)) (- a t))) 0.0)
(-
(+ (+ (* y (/ a t)) (+ y (/ (* x z) t))) (* (/ a t) (/ (* x z) t)))
(+ (+ (* y (/ z t)) (* x (/ a t))) (* (/ a t) (* y (/ z t)))))
(if (<= (+ x (/ (* (- y x) (- z t)) (- a t))) 2.283615310228694e+305)
(+ x (* (* (- y x) (- z t)) (/ 1.0 (- a t))))
(* y (- (/ z (- a t)) (/ t (- a t))))))))double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (a - t));
}
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x + (((y - x) * (z - t)) / (a - t))) <= -9.167360412588197e-295) {
tmp = x + ((y - x) / ((a - t) / (z - t)));
} else if ((x + (((y - x) * (z - t)) / (a - t))) <= 0.0) {
tmp = (((y * (a / t)) + (y + ((x * z) / t))) + ((a / t) * ((x * z) / t))) - (((y * (z / t)) + (x * (a / t))) + ((a / t) * (y * (z / t))));
} else if ((x + (((y - x) * (z - t)) / (a - t))) <= 2.283615310228694e+305) {
tmp = x + (((y - x) * (z - t)) * (1.0 / (a - t)));
} else {
tmp = y * ((z / (a - t)) - (t / (a - t)));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
Results
| Original | 24.7 |
|---|---|
| Target | 9.4 |
| Herbie | 7.7 |
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < -9.1673604125881965e-295Initial program 21.9
rmApplied associate-/l*_binary647.4
if -9.1673604125881965e-295 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < 0.0Initial program 60.6
rmApplied *-un-lft-identity_binary6460.6
Applied times-frac_binary6460.4
Simplified60.4
rmApplied add-cbrt-cube_binary6460.4
Simplified60.4
Taylor expanded around 0 2.8
Simplified1.2
if 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < 2.2836153102286941e305Initial program 1.9
rmApplied *-un-lft-identity_binary641.9
Applied times-frac_binary642.8
Simplified2.8
rmApplied div-inv_binary642.9
Applied associate-*r*_binary642.0
Simplified2.0
if 2.2836153102286941e305 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) Initial program 63.7
rmApplied *-un-lft-identity_binary6463.7
Applied times-frac_binary6417.7
Simplified17.7
rmApplied add-cbrt-cube_binary6421.5
Simplified21.5
Taylor expanded around -inf 25.4
Final simplification7.7
herbie shell --seed 2021118
(FPCore (x y z t a)
:name "Graphics.Rendering.Chart.Axis.Types:linMap from Chart-1.5.3"
:precision binary64
:herbie-target
(if (< a -1.6153062845442575e-142) (+ x (* (/ (- y x) 1.0) (/ (- z t) (- a t)))) (if (< a 3.774403170083174e-182) (- y (* (/ z t) (- y x))) (+ x (* (/ (- y x) 1.0) (/ (- z t) (- a t))))))
(+ x (/ (* (- y x) (- z t)) (- a t))))