(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)))))
(if (<= t_1 -6.116899373379197e-258)
(+ x (* y (+ (/ z (- t a)) (- 1.0 (/ t (- t a))))))
(if (<= t_1 0.0)
(+ x (- (/ z (/ (- t a) y)) (* y (/ a t))))
(+ x (+ y (* (- z t) (/ y (- t 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 tmp;
if (t_1 <= -6.116899373379197e-258) {
tmp = x + (y * ((z / (t - a)) + (1.0 - (t / (t - a)))));
} else if (t_1 <= 0.0) {
tmp = x + ((z / ((t - a) / y)) - (y * (a / t)));
} else {
tmp = x + (y + ((z - t) * (y / (t - 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) :: tmp
t_1 = (x + y) - ((y * (z - t)) / (a - t))
if (t_1 <= (-6.116899373379197d-258)) then
tmp = x + (y * ((z / (t - a)) + (1.0d0 - (t / (t - a)))))
else if (t_1 <= 0.0d0) then
tmp = x + ((z / ((t - a) / y)) - (y * (a / t)))
else
tmp = x + (y + ((z - t) * (y / (t - 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 tmp;
if (t_1 <= -6.116899373379197e-258) {
tmp = x + (y * ((z / (t - a)) + (1.0 - (t / (t - a)))));
} else if (t_1 <= 0.0) {
tmp = x + ((z / ((t - a) / y)) - (y * (a / t)));
} else {
tmp = x + (y + ((z - t) * (y / (t - 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)) tmp = 0 if t_1 <= -6.116899373379197e-258: tmp = x + (y * ((z / (t - a)) + (1.0 - (t / (t - a))))) elif t_1 <= 0.0: tmp = x + ((z / ((t - a) / y)) - (y * (a / t))) else: tmp = x + (y + ((z - t) * (y / (t - 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))) tmp = 0.0 if (t_1 <= -6.116899373379197e-258) tmp = Float64(x + Float64(y * Float64(Float64(z / Float64(t - a)) + Float64(1.0 - Float64(t / Float64(t - a)))))); elseif (t_1 <= 0.0) tmp = Float64(x + Float64(Float64(z / Float64(Float64(t - a) / y)) - Float64(y * Float64(a / t)))); else tmp = Float64(x + Float64(y + Float64(Float64(z - t) * Float64(y / Float64(t - 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)); tmp = 0.0; if (t_1 <= -6.116899373379197e-258) tmp = x + (y * ((z / (t - a)) + (1.0 - (t / (t - a))))); elseif (t_1 <= 0.0) tmp = x + ((z / ((t - a) / y)) - (y * (a / t))); else tmp = x + (y + ((z - t) * (y / (t - 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]}, If[LessEqual[t$95$1, -6.116899373379197e-258], N[(x + N[(y * N[(N[(z / N[(t - a), $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[(t / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(x + N[(N[(z / N[(N[(t - a), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] - N[(y * N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y + N[(N[(z - t), $MachinePrecision] * N[(y / N[(t - a), $MachinePrecision]), $MachinePrecision]), $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}\\
\mathbf{if}\;t_1 \leq -6.116899373379197 \cdot 10^{-258}:\\
\;\;\;\;x + y \cdot \left(\frac{z}{t - a} + \left(1 - \frac{t}{t - a}\right)\right)\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;x + \left(\frac{z}{\frac{t - a}{y}} - y \cdot \frac{a}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(y + \left(z - t\right) \cdot \frac{y}{t - 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.9 |
| Herbie | 5.0 |
if (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -6.1168993733791966e-258Initial program 13.0
Simplified5.7
Taylor expanded in y around 0 5.7
Simplified3.9
if -6.1168993733791966e-258 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 0.0Initial program 59.0
Simplified35.7
Taylor expanded in z around 0 35.9
Simplified31.7
Applied egg-rr31.7
Taylor expanded in t around inf 5.9
Simplified5.8
if 0.0 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) Initial program 12.4
Simplified5.5
Taylor expanded in y around 0 5.5
Simplified3.6
Taylor expanded in y around 0 5.5
Simplified5.9
Final simplification5.0
herbie shell --seed 2022153
(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))))