(FPCore (x y z t) :precision binary64 (* (/ (- x y) (- z y)) t))
(FPCore (x y z t)
:precision binary64
(if (<= y -1.2e+83)
(/ t (/ (- y z) (- y x)))
(if (<= y 2.3e-198)
(* (- y x) (/ t (- y z)))
(/ t (- (/ z (- x y)) (/ 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 tmp;
if (y <= -1.2e+83) {
tmp = t / ((y - z) / (y - x));
} else if (y <= 2.3e-198) {
tmp = (y - x) * (t / (y - z));
} else {
tmp = t / ((z / (x - y)) - (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) :: tmp
if (y <= (-1.2d+83)) then
tmp = t / ((y - z) / (y - x))
else if (y <= 2.3d-198) then
tmp = (y - x) * (t / (y - z))
else
tmp = t / ((z / (x - y)) - (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 tmp;
if (y <= -1.2e+83) {
tmp = t / ((y - z) / (y - x));
} else if (y <= 2.3e-198) {
tmp = (y - x) * (t / (y - z));
} else {
tmp = t / ((z / (x - y)) - (y / (x - y)));
}
return tmp;
}
def code(x, y, z, t): return ((x - y) / (z - y)) * t
def code(x, y, z, t): tmp = 0 if y <= -1.2e+83: tmp = t / ((y - z) / (y - x)) elif y <= 2.3e-198: tmp = (y - x) * (t / (y - z)) else: tmp = t / ((z / (x - y)) - (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) tmp = 0.0 if (y <= -1.2e+83) tmp = Float64(t / Float64(Float64(y - z) / Float64(y - x))); elseif (y <= 2.3e-198) tmp = Float64(Float64(y - x) * Float64(t / Float64(y - z))); else tmp = Float64(t / Float64(Float64(z / Float64(x - y)) - Float64(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) tmp = 0.0; if (y <= -1.2e+83) tmp = t / ((y - z) / (y - x)); elseif (y <= 2.3e-198) tmp = (y - x) * (t / (y - z)); else tmp = t / ((z / (x - y)) - (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_] := If[LessEqual[y, -1.2e+83], N[(t / N[(N[(y - z), $MachinePrecision] / N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.3e-198], N[(N[(y - x), $MachinePrecision] * N[(t / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t / N[(N[(z / N[(x - y), $MachinePrecision]), $MachinePrecision] - N[(y / N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\frac{x - y}{z - y} \cdot t
\begin{array}{l}
\mathbf{if}\;y \leq -1.2 \cdot 10^{+83}:\\
\;\;\;\;\frac{t}{\frac{y - z}{y - x}}\\
\mathbf{elif}\;y \leq 2.3 \cdot 10^{-198}:\\
\;\;\;\;\left(y - x\right) \cdot \frac{t}{y - z}\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{\frac{z}{x - y} - \frac{y}{x - y}}\\
\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 | 2.8 |
if y < -1.19999999999999996e83Initial program 0.1
Applied egg-rr0.1
Applied egg-rr0.1
if -1.19999999999999996e83 < y < 2.30000000000000013e-198Initial program 3.9
Simplified5.5
if 2.30000000000000013e-198 < y Initial program 1.5
Applied egg-rr1.6
Taylor expanded in z around 0 1.6
Final simplification2.8
herbie shell --seed 2022166
(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))