(FPCore (x y z t) :precision binary64 (+ (* (/ x y) (- z t)) t))
(FPCore (x y z t)
:precision binary64
(if (<= y -2.4152352409574924e-67)
(fma x (/ (- z t) y) t)
(if (<= y -1.446115896866537e-282)
(+ t (/ (* x (- z t)) y))
(+ t (* (- z t) (/ x y))))))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 tmp;
if (y <= -2.4152352409574924e-67) {
tmp = fma(x, ((z - t) / y), t);
} else if (y <= -1.446115896866537e-282) {
tmp = t + ((x * (z - t)) / y);
} else {
tmp = t + ((z - t) * (x / y));
}
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) tmp = 0.0 if (y <= -2.4152352409574924e-67) tmp = fma(x, Float64(Float64(z - t) / y), t); elseif (y <= -1.446115896866537e-282) tmp = Float64(t + Float64(Float64(x * Float64(z - t)) / y)); else tmp = Float64(t + Float64(Float64(z - t) * Float64(x / y))); end return 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_] := If[LessEqual[y, -2.4152352409574924e-67], N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision] + t), $MachinePrecision], If[LessEqual[y, -1.446115896866537e-282], N[(t + N[(N[(x * N[(z - t), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(t + N[(N[(z - t), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\frac{x}{y} \cdot \left(z - t\right) + t
\begin{array}{l}
\mathbf{if}\;y \leq -2.4152352409574924 \cdot 10^{-67}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{z - t}{y}, t\right)\\
\mathbf{elif}\;y \leq -1.446115896866537 \cdot 10^{-282}:\\
\;\;\;\;t + \frac{x \cdot \left(z - t\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;t + \left(z - t\right) \cdot \frac{x}{y}\\
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
| Original | 2.2 |
|---|---|
| Target | 2.3 |
| Herbie | 2.0 |
if y < -2.41523524095749241e-67Initial program 1.2
Simplified1.4
if -2.41523524095749241e-67 < y < -1.44611589686653695e-282Initial program 4.1
Taylor expanded in x around 0 1.4
if -1.44611589686653695e-282 < y Initial program 2.5
Final simplification2.0
herbie shell --seed 2022153
(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))