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




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 2.0 |
|---|---|
| Target | 2.2 |
| Herbie | 1.9 |
if t < -4.3999999999999998e-162 or -2.75e-288 < t Initial program 1.6
Applied egg-rr1.5
if -4.3999999999999998e-162 < t < -2.75e-288Initial program 4.8
Applied egg-rr5.3
Final simplification1.9
herbie shell --seed 2022162
(FPCore (x y z t)
:name "Numeric.Signal.Multichannel:$cget from hsignal-0.2.7.1"
:precision binary64
:herbie-target
(if (< z 2.759456554562692e-282) (+ (* (/ x y) (- z t)) t) (if (< z 2.326994450874436e-110) (+ (* x (/ (- z t) y)) t) (+ (* (/ x y) (- z t)) t)))
(+ (* (/ x y) (- z t)) t))