(FPCore (x y z t a) :precision binary64 (- (+ x y) (/ (* (- z t) y) (- a t))))
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (+ x y) (/ (* y (- z t)) (- a t)))) (t_2 (+ 1.0 (/ a t))))
(if (<= t_1 -9.590140231623633e-153)
(+ y (- x (/ y (/ (- a t) z))))
(if (<= t_1 0.0)
(- (+ x (* t_2 (/ (* y z) t))) (* y (* (/ a t) t_2)))
(if (<= t_1 1.5506509821356148e+260) t_1 (+ x (* (/ y t) (- z a))))))))double code(double x, double y, double z, double t, double a) {
return (x + y) - (((z - t) * y) / (a - t));
}
double code(double x, double y, double z, double t, double a) {
double t_1 = (x + y) - ((y * (z - t)) / (a - t));
double t_2 = 1.0 + (a / t);
double tmp;
if (t_1 <= -9.590140231623633e-153) {
tmp = y + (x - (y / ((a - t) / z)));
} else if (t_1 <= 0.0) {
tmp = (x + (t_2 * ((y * z) / t))) - (y * ((a / t) * t_2));
} else if (t_1 <= 1.5506509821356148e+260) {
tmp = t_1;
} else {
tmp = x + ((y / t) * (z - a));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = (x + y) - (((z - t) * y) / (a - t))
end function
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (x + y) - ((y * (z - t)) / (a - t))
t_2 = 1.0d0 + (a / t)
if (t_1 <= (-9.590140231623633d-153)) then
tmp = y + (x - (y / ((a - t) / z)))
else if (t_1 <= 0.0d0) then
tmp = (x + (t_2 * ((y * z) / t))) - (y * ((a / t) * t_2))
else if (t_1 <= 1.5506509821356148d+260) then
tmp = t_1
else
tmp = x + ((y / t) * (z - a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
return (x + y) - (((z - t) * y) / (a - t));
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (x + y) - ((y * (z - t)) / (a - t));
double t_2 = 1.0 + (a / t);
double tmp;
if (t_1 <= -9.590140231623633e-153) {
tmp = y + (x - (y / ((a - t) / z)));
} else if (t_1 <= 0.0) {
tmp = (x + (t_2 * ((y * z) / t))) - (y * ((a / t) * t_2));
} else if (t_1 <= 1.5506509821356148e+260) {
tmp = t_1;
} else {
tmp = x + ((y / t) * (z - a));
}
return tmp;
}
def code(x, y, z, t, a): return (x + y) - (((z - t) * y) / (a - t))
def code(x, y, z, t, a): t_1 = (x + y) - ((y * (z - t)) / (a - t)) t_2 = 1.0 + (a / t) tmp = 0 if t_1 <= -9.590140231623633e-153: tmp = y + (x - (y / ((a - t) / z))) elif t_1 <= 0.0: tmp = (x + (t_2 * ((y * z) / t))) - (y * ((a / t) * t_2)) elif t_1 <= 1.5506509821356148e+260: tmp = t_1 else: tmp = x + ((y / t) * (z - a)) return tmp
function code(x, y, z, t, a) return Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))) end
function code(x, y, z, t, a) t_1 = Float64(Float64(x + y) - Float64(Float64(y * Float64(z - t)) / Float64(a - t))) t_2 = Float64(1.0 + Float64(a / t)) tmp = 0.0 if (t_1 <= -9.590140231623633e-153) tmp = Float64(y + Float64(x - Float64(y / Float64(Float64(a - t) / z)))); elseif (t_1 <= 0.0) tmp = Float64(Float64(x + Float64(t_2 * Float64(Float64(y * z) / t))) - Float64(y * Float64(Float64(a / t) * t_2))); elseif (t_1 <= 1.5506509821356148e+260) tmp = t_1; else tmp = Float64(x + Float64(Float64(y / t) * Float64(z - a))); end return tmp end
function tmp = code(x, y, z, t, a) tmp = (x + y) - (((z - t) * y) / (a - t)); end
function tmp_2 = code(x, y, z, t, a) t_1 = (x + y) - ((y * (z - t)) / (a - t)); t_2 = 1.0 + (a / t); tmp = 0.0; if (t_1 <= -9.590140231623633e-153) tmp = y + (x - (y / ((a - t) / z))); elseif (t_1 <= 0.0) tmp = (x + (t_2 * ((y * z) / t))) - (y * ((a / t) * t_2)); elseif (t_1 <= 1.5506509821356148e+260) tmp = t_1; else tmp = x + ((y / t) * (z - a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x + y), $MachinePrecision] - N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 + N[(a / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -9.590140231623633e-153], N[(y + N[(x - N[(y / N[(N[(a - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(N[(x + N[(t$95$2 * N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(y * N[(N[(a / t), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1.5506509821356148e+260], t$95$1, N[(x + N[(N[(y / t), $MachinePrecision] * N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
\begin{array}{l}
t_1 := \left(x + y\right) - \frac{y \cdot \left(z - t\right)}{a - t}\\
t_2 := 1 + \frac{a}{t}\\
\mathbf{if}\;t_1 \leq -9.590140231623633 \cdot 10^{-153}:\\
\;\;\;\;y + \left(x - \frac{y}{\frac{a - t}{z}}\right)\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;\left(x + t_2 \cdot \frac{y \cdot z}{t}\right) - y \cdot \left(\frac{a}{t} \cdot t_2\right)\\
\mathbf{elif}\;t_1 \leq 1.5506509821356148 \cdot 10^{+260}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{t} \cdot \left(z - a\right)\\
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
Results
| Original | 16.4 |
|---|---|
| Target | 8.5 |
| Herbie | 8.3 |
if (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -9.5901402316236329e-153Initial program 13.1
Simplified8.1
Taylor expanded in y around 0 12.9
Simplified8.1
Taylor expanded in z around inf 11.9
Simplified11.9
Applied associate-/l*_binary649.3
if -9.5901402316236329e-153 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 0.0Initial program 47.8
Simplified47.5
Taylor expanded in t around inf 13.6
Simplified9.8
if 0.0 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 1.55065098213561478e260Initial program 1.6
if 1.55065098213561478e260 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) Initial program 41.8
Simplified20.3
Taylor expanded in t around inf 33.9
Simplified21.0
Final simplification8.3
herbie shell --seed 2022131
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, B"
:precision binary64
:herbie-target
(if (< (- (+ x y) (/ (* (- z t) y) (- a t))) -1.3664970889390727e-7) (- (+ y x) (* (* (- z t) (/ 1.0 (- a t))) y)) (if (< (- (+ x y) (/ (* (- z t) y) (- a t))) 1.4754293444577233e-239) (/ (- (* y (- a z)) (* x t)) (- a t)) (- (+ y x) (* (* (- z t) (/ 1.0 (- a t))) y))))
(- (+ x y) (/ (* (- z t) y) (- a t))))