(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 t) (- z a)))))
(if (<= t -3.137181392971283e+60)
t_1
(if (<= t 5.542187589704571e-282)
(- (+ y (+ x (/ (* t y) (- a t)))) (/ (* y z) (- a t)))
(if (<= t 2.3034710670409075e+230)
(+ x (+ y (* y (/ (- t z) (- a t)))))
t_1)))))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 / t) * (z - a));
double tmp;
if (t <= -3.137181392971283e+60) {
tmp = t_1;
} else if (t <= 5.542187589704571e-282) {
tmp = (y + (x + ((t * y) / (a - t)))) - ((y * z) / (a - t));
} else if (t <= 2.3034710670409075e+230) {
tmp = x + (y + (y * ((t - z) / (a - t))));
} else {
tmp = t_1;
}
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 / t) * (z - a))
if (t <= (-3.137181392971283d+60)) then
tmp = t_1
else if (t <= 5.542187589704571d-282) then
tmp = (y + (x + ((t * y) / (a - t)))) - ((y * z) / (a - t))
else if (t <= 2.3034710670409075d+230) then
tmp = x + (y + (y * ((t - z) / (a - t))))
else
tmp = t_1
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 / t) * (z - a));
double tmp;
if (t <= -3.137181392971283e+60) {
tmp = t_1;
} else if (t <= 5.542187589704571e-282) {
tmp = (y + (x + ((t * y) / (a - t)))) - ((y * z) / (a - t));
} else if (t <= 2.3034710670409075e+230) {
tmp = x + (y + (y * ((t - z) / (a - t))));
} else {
tmp = t_1;
}
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 / t) * (z - a)) tmp = 0 if t <= -3.137181392971283e+60: tmp = t_1 elif t <= 5.542187589704571e-282: tmp = (y + (x + ((t * y) / (a - t)))) - ((y * z) / (a - t)) elif t <= 2.3034710670409075e+230: tmp = x + (y + (y * ((t - z) / (a - t)))) else: tmp = t_1 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(x + Float64(Float64(y / t) * Float64(z - a))) tmp = 0.0 if (t <= -3.137181392971283e+60) tmp = t_1; elseif (t <= 5.542187589704571e-282) tmp = Float64(Float64(y + Float64(x + Float64(Float64(t * y) / Float64(a - t)))) - Float64(Float64(y * z) / Float64(a - t))); elseif (t <= 2.3034710670409075e+230) tmp = Float64(x + Float64(y + Float64(y * Float64(Float64(t - z) / Float64(a - t))))); else tmp = t_1; 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 / t) * (z - a)); tmp = 0.0; if (t <= -3.137181392971283e+60) tmp = t_1; elseif (t <= 5.542187589704571e-282) tmp = (y + (x + ((t * y) / (a - t)))) - ((y * z) / (a - t)); elseif (t <= 2.3034710670409075e+230) tmp = x + (y + (y * ((t - z) / (a - t)))); else tmp = t_1; 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[(x + N[(N[(y / t), $MachinePrecision] * N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -3.137181392971283e+60], t$95$1, If[LessEqual[t, 5.542187589704571e-282], N[(N[(y + N[(x + N[(N[(t * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(y * z), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.3034710670409075e+230], N[(x + N[(y + N[(y * N[(N[(t - z), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
\begin{array}{l}
t_1 := x + \frac{y}{t} \cdot \left(z - a\right)\\
\mathbf{if}\;t \leq -3.137181392971283 \cdot 10^{+60}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 5.542187589704571 \cdot 10^{-282}:\\
\;\;\;\;\left(y + \left(x + \frac{t \cdot y}{a - t}\right)\right) - \frac{y \cdot z}{a - t}\\
\mathbf{elif}\;t \leq 2.3034710670409075 \cdot 10^{+230}:\\
\;\;\;\;x + \left(y + y \cdot \frac{t - z}{a - t}\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\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.0 |
|---|---|
| Target | 8.2 |
| Herbie | 6.8 |
if t < -3.13718139297128312e60 or 2.30347106704090748e230 < t Initial program 29.5
Simplified20.3
Taylor expanded in t around inf 15.8
Simplified8.1
if -3.13718139297128312e60 < t < 5.54218758970457104e-282Initial program 6.9
Simplified5.6
Taylor expanded in y around 0 6.1
if 5.54218758970457104e-282 < t < 2.30347106704090748e230Initial program 13.4
Simplified9.0
Applied egg-rr9.0
Applied egg-rr6.5
Final simplification6.8
herbie shell --seed 2022133
(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))))