(FPCore (x y z t) :precision binary64 (+ (* (/ x y) (- z t)) t))
(FPCore (x y z t)
:precision binary64
(if (<= y -2.2024189491739263e-21)
(+ t (/ x (/ y (- z t))))
(if (<= y 2.8858824852870217e-56)
(+ t (* (* x (- z t)) (/ 1.0 y)))
(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 (y <= -2.2024189491739263e-21) {
tmp = t + (x / (y / (z - t)));
} else if (y <= 2.8858824852870217e-56) {
tmp = t + ((x * (z - t)) * (1.0 / y));
} 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 (y <= -2.2024189491739263e-21) tmp = Float64(t + Float64(x / Float64(y / Float64(z - t)))); elseif (y <= 2.8858824852870217e-56) tmp = Float64(t + Float64(Float64(x * Float64(z - t)) * Float64(1.0 / y))); 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[y, -2.2024189491739263e-21], N[(t + N[(x / N[(y / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.8858824852870217e-56], N[(t + N[(N[(x * N[(z - t), $MachinePrecision]), $MachinePrecision] * N[(1.0 / y), $MachinePrecision]), $MachinePrecision]), $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}\;y \leq -2.2024189491739263 \cdot 10^{-21}:\\
\;\;\;\;t + \frac{x}{\frac{y}{z - t}}\\
\mathbf{elif}\;y \leq 2.8858824852870217 \cdot 10^{-56}:\\
\;\;\;\;t + \left(x \cdot \left(z - t\right)\right) \cdot \frac{1}{y}\\
\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.0 |
|---|---|
| Target | 2.3 |
| Herbie | 1.4 |
if y < -2.20241894917392626e-21Initial program 1.1
Applied egg-rr0.8
if -2.20241894917392626e-21 < y < 2.8858824852870217e-56Initial program 3.8
Applied egg-rr4.5
Applied egg-rr2.1
if 2.8858824852870217e-56 < y Initial program 1.2
Applied egg-rr1.2
Final simplification1.4
herbie shell --seed 2022150
(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))