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




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
| Original | 2.2 |
|---|---|
| Target | 2.4 |
| Herbie | 2.1 |
if t < -1.49999999999999995e-56Initial program 0.4
Applied egg-rr0.4
if -1.49999999999999995e-56 < t < 6.2000000000000003e-126Initial program 4.7
Simplified4.6
if 6.2000000000000003e-126 < t Initial program 0.6
Applied egg-rr0.6
Final simplification2.1
herbie shell --seed 2022166
(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))