(FPCore (x y z t) :precision binary64 (* (/ (- x y) (- z y)) t))
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (- x y) (- z y))) (t_2 (/ t (- z y))))
(if (<= t_1 -3.5609834547508955e-167)
(/ t (- (/ z (- x y)) (/ y (- x y))))
(if (<= t_1 1.59977091405e-313) (- (* x t_2) (* y t_2)) (* t_1 t)))))double code(double x, double y, double z, double t) {
return ((x - y) / (z - y)) * t;
}
double code(double x, double y, double z, double t) {
double t_1 = (x - y) / (z - y);
double t_2 = t / (z - y);
double tmp;
if (t_1 <= -3.5609834547508955e-167) {
tmp = t / ((z / (x - y)) - (y / (x - y)));
} else if (t_1 <= 1.59977091405e-313) {
tmp = (x * t_2) - (y * t_2);
} else {
tmp = t_1 * t;
}
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 - y)) * 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) :: t_2
real(8) :: tmp
t_1 = (x - y) / (z - y)
t_2 = t / (z - y)
if (t_1 <= (-3.5609834547508955d-167)) then
tmp = t / ((z / (x - y)) - (y / (x - y)))
else if (t_1 <= 1.59977091405d-313) then
tmp = (x * t_2) - (y * t_2)
else
tmp = t_1 * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
return ((x - y) / (z - y)) * t;
}
public static double code(double x, double y, double z, double t) {
double t_1 = (x - y) / (z - y);
double t_2 = t / (z - y);
double tmp;
if (t_1 <= -3.5609834547508955e-167) {
tmp = t / ((z / (x - y)) - (y / (x - y)));
} else if (t_1 <= 1.59977091405e-313) {
tmp = (x * t_2) - (y * t_2);
} else {
tmp = t_1 * t;
}
return tmp;
}
def code(x, y, z, t): return ((x - y) / (z - y)) * t
def code(x, y, z, t): t_1 = (x - y) / (z - y) t_2 = t / (z - y) tmp = 0 if t_1 <= -3.5609834547508955e-167: tmp = t / ((z / (x - y)) - (y / (x - y))) elif t_1 <= 1.59977091405e-313: tmp = (x * t_2) - (y * t_2) else: tmp = t_1 * t return tmp
function code(x, y, z, t) return Float64(Float64(Float64(x - y) / Float64(z - y)) * t) end
function code(x, y, z, t) t_1 = Float64(Float64(x - y) / Float64(z - y)) t_2 = Float64(t / Float64(z - y)) tmp = 0.0 if (t_1 <= -3.5609834547508955e-167) tmp = Float64(t / Float64(Float64(z / Float64(x - y)) - Float64(y / Float64(x - y)))); elseif (t_1 <= 1.59977091405e-313) tmp = Float64(Float64(x * t_2) - Float64(y * t_2)); else tmp = Float64(t_1 * t); end return tmp end
function tmp = code(x, y, z, t) tmp = ((x - y) / (z - y)) * t; end
function tmp_2 = code(x, y, z, t) t_1 = (x - y) / (z - y); t_2 = t / (z - y); tmp = 0.0; if (t_1 <= -3.5609834547508955e-167) tmp = t / ((z / (x - y)) - (y / (x - y))); elseif (t_1 <= 1.59977091405e-313) tmp = (x * t_2) - (y * t_2); else tmp = t_1 * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := N[(N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -3.5609834547508955e-167], N[(t / N[(N[(z / N[(x - y), $MachinePrecision]), $MachinePrecision] - N[(y / N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1.59977091405e-313], N[(N[(x * t$95$2), $MachinePrecision] - N[(y * t$95$2), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * t), $MachinePrecision]]]]]
\frac{x - y}{z - y} \cdot t
\begin{array}{l}
t_1 := \frac{x - y}{z - y}\\
t_2 := \frac{t}{z - y}\\
\mathbf{if}\;t_1 \leq -3.5609834547508955 \cdot 10^{-167}:\\
\;\;\;\;\frac{t}{\frac{z}{x - y} - \frac{y}{x - y}}\\
\mathbf{elif}\;t_1 \leq 1.59977091405 \cdot 10^{-313}:\\
\;\;\;\;x \cdot t_2 - y \cdot t_2\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot t\\
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 2.2 |
|---|---|
| Target | 2.2 |
| Herbie | 1.3 |
if (/.f64 (-.f64 x y) (-.f64 z y)) < -3.56098345475089546e-167Initial program 2.5
Applied egg-rr2.2
Taylor expanded in z around 0 2.2
if -3.56098345475089546e-167 < (/.f64 (-.f64 x y) (-.f64 z y)) < 1.59977091405e-313Initial program 10.4
Applied egg-rr11.5
Applied egg-rr1.0
if 1.59977091405e-313 < (/.f64 (-.f64 x y) (-.f64 z y)) Initial program 1.0
Applied egg-rr0.9
Applied egg-rr1.0
Final simplification1.3
herbie shell --seed 2022150
(FPCore (x y z t)
:name "Numeric.Signal.Multichannel:$cput from hsignal-0.2.7.1"
:precision binary64
:herbie-target
(/ t (/ (- z y) (- x y)))
(* (/ (- x y) (- z y)) t))