(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 -4.198064154831332e+96)
t_1
(if (<= t 4.65767209864162e+83)
(- (+ y (+ x (/ (* t y) (- a t)))) (/ y (/ (- a t) z)))
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 <= -4.198064154831332e+96) {
tmp = t_1;
} else if (t <= 4.65767209864162e+83) {
tmp = (y + (x + ((t * y) / (a - t)))) - (y / ((a - t) / z));
} 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 <= (-4.198064154831332d+96)) then
tmp = t_1
else if (t <= 4.65767209864162d+83) then
tmp = (y + (x + ((t * y) / (a - t)))) - (y / ((a - t) / z))
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 <= -4.198064154831332e+96) {
tmp = t_1;
} else if (t <= 4.65767209864162e+83) {
tmp = (y + (x + ((t * y) / (a - t)))) - (y / ((a - t) / z));
} 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 <= -4.198064154831332e+96: tmp = t_1 elif t <= 4.65767209864162e+83: tmp = (y + (x + ((t * y) / (a - t)))) - (y / ((a - t) / z)) 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 <= -4.198064154831332e+96) tmp = t_1; elseif (t <= 4.65767209864162e+83) tmp = Float64(Float64(y + Float64(x + Float64(Float64(t * y) / Float64(a - t)))) - Float64(y / Float64(Float64(a - t) / z))); 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 <= -4.198064154831332e+96) tmp = t_1; elseif (t <= 4.65767209864162e+83) tmp = (y + (x + ((t * y) / (a - t)))) - (y / ((a - t) / z)); 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, -4.198064154831332e+96], t$95$1, If[LessEqual[t, 4.65767209864162e+83], N[(N[(y + N[(x + N[(N[(t * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(y / N[(N[(a - t), $MachinePrecision] / z), $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 -4.198064154831332 \cdot 10^{+96}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 4.65767209864162 \cdot 10^{+83}:\\
\;\;\;\;\left(y + \left(x + \frac{t \cdot y}{a - t}\right)\right) - \frac{y}{\frac{a - t}{z}}\\
\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.6 |
|---|---|
| Target | 8.8 |
| Herbie | 6.2 |
if t < -4.19806415483133219e96 or 4.65767209864161974e83 < t Initial program 30.3
Simplified20.9
Taylor expanded in t around inf 15.0
Simplified7.7
if -4.19806415483133219e96 < t < 4.65767209864161974e83Initial program 8.1
Simplified6.2
Taylor expanded in y around 0 6.9
Applied associate-/l*_binary645.3
Final simplification6.2
herbie shell --seed 2022130
(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))))