(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))))
(if (<= t_1 -1e-121)
(* t (- (/ x (- z y)) (/ y (- z y))))
(if (<= t_1 2e-272)
(* (- x y) (/ t (- z y)))
(/ t (/ (- z y) (- x y)))))))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 tmp;
if (t_1 <= -1e-121) {
tmp = t * ((x / (z - y)) - (y / (z - y)));
} else if (t_1 <= 2e-272) {
tmp = (x - y) * (t / (z - y));
} else {
tmp = t / ((z - y) / (x - y));
}
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) :: tmp
t_1 = (x - y) / (z - y)
if (t_1 <= (-1d-121)) then
tmp = t * ((x / (z - y)) - (y / (z - y)))
else if (t_1 <= 2d-272) then
tmp = (x - y) * (t / (z - y))
else
tmp = t / ((z - y) / (x - y))
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 tmp;
if (t_1 <= -1e-121) {
tmp = t * ((x / (z - y)) - (y / (z - y)));
} else if (t_1 <= 2e-272) {
tmp = (x - y) * (t / (z - y));
} else {
tmp = t / ((z - y) / (x - y));
}
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) tmp = 0 if t_1 <= -1e-121: tmp = t * ((x / (z - y)) - (y / (z - y))) elif t_1 <= 2e-272: tmp = (x - y) * (t / (z - y)) else: tmp = t / ((z - y) / (x - y)) 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)) tmp = 0.0 if (t_1 <= -1e-121) tmp = Float64(t * Float64(Float64(x / Float64(z - y)) - Float64(y / Float64(z - y)))); elseif (t_1 <= 2e-272) tmp = Float64(Float64(x - y) * Float64(t / Float64(z - y))); else tmp = Float64(t / Float64(Float64(z - y) / Float64(x - y))); 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); tmp = 0.0; if (t_1 <= -1e-121) tmp = t * ((x / (z - y)) - (y / (z - y))); elseif (t_1 <= 2e-272) tmp = (x - y) * (t / (z - y)); else tmp = t / ((z - y) / (x - y)); 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]}, If[LessEqual[t$95$1, -1e-121], N[(t * N[(N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision] - N[(y / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e-272], N[(N[(x - y), $MachinePrecision] * N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t / N[(N[(z - y), $MachinePrecision] / N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\frac{x - y}{z - y} \cdot t
\begin{array}{l}
t_1 := \frac{x - y}{z - y}\\
\mathbf{if}\;t_1 \leq -1 \cdot 10^{-121}:\\
\;\;\;\;t \cdot \left(\frac{x}{z - y} - \frac{y}{z - y}\right)\\
\mathbf{elif}\;t_1 \leq 2 \cdot 10^{-272}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{\frac{z - y}{x - y}}\\
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 2.1 |
|---|---|
| Target | 2.1 |
| Herbie | 1.2 |
if (/.f64 (-.f64 x y) (-.f64 z y)) < -9.9999999999999998e-122Initial program 2.6
Taylor expanded in x around 0 10.7
Taylor expanded in t around 0 2.6
Simplified2.6
if -9.9999999999999998e-122 < (/.f64 (-.f64 x y) (-.f64 z y)) < 1.99999999999999986e-272Initial program 8.4
Applied egg-rr9.3
Applied egg-rr1.4
if 1.99999999999999986e-272 < (/.f64 (-.f64 x y) (-.f64 z y)) Initial program 0.8
Applied egg-rr0.7
Final simplification1.2
herbie shell --seed 2022170
(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))