(FPCore (x y z) :precision binary64 (/ (* x (+ y z)) z))
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (* x (+ y z)) z)))
(if (<= t_0 -6.582729939135484e-168)
(fma y (/ x z) x)
(if (<= t_0 1.9816485472502953e+98)
(+ x (* x (/ y z)))
(if (<= t_0 2.325475704519075e+238) t_0 (fma (/ y z) x x))))))double code(double x, double y, double z) {
return (x * (y + z)) / z;
}
double code(double x, double y, double z) {
double t_0 = (x * (y + z)) / z;
double tmp;
if (t_0 <= -6.582729939135484e-168) {
tmp = fma(y, (x / z), x);
} else if (t_0 <= 1.9816485472502953e+98) {
tmp = x + (x * (y / z));
} else if (t_0 <= 2.325475704519075e+238) {
tmp = t_0;
} else {
tmp = fma((y / z), x, x);
}
return tmp;
}
function code(x, y, z) return Float64(Float64(x * Float64(y + z)) / z) end
function code(x, y, z) t_0 = Float64(Float64(x * Float64(y + z)) / z) tmp = 0.0 if (t_0 <= -6.582729939135484e-168) tmp = fma(y, Float64(x / z), x); elseif (t_0 <= 1.9816485472502953e+98) tmp = Float64(x + Float64(x * Float64(y / z))); elseif (t_0 <= 2.325475704519075e+238) tmp = t_0; else tmp = fma(Float64(y / z), x, x); end return tmp end
code[x_, y_, z_] := N[(N[(x * N[(y + z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x * N[(y + z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]}, If[LessEqual[t$95$0, -6.582729939135484e-168], N[(y * N[(x / z), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$0, 1.9816485472502953e+98], N[(x + N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2.325475704519075e+238], t$95$0, N[(N[(y / z), $MachinePrecision] * x + x), $MachinePrecision]]]]]
\frac{x \cdot \left(y + z\right)}{z}
\begin{array}{l}
t_0 := \frac{x \cdot \left(y + z\right)}{z}\\
\mathbf{if}\;t_0 \leq -6.582729939135484 \cdot 10^{-168}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{x}{z}, x\right)\\
\mathbf{elif}\;t_0 \leq 1.9816485472502953 \cdot 10^{+98}:\\
\;\;\;\;x + x \cdot \frac{y}{z}\\
\mathbf{elif}\;t_0 \leq 2.325475704519075 \cdot 10^{+238}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{z}, x, x\right)\\
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 12.1 |
|---|---|
| Target | 3.1 |
| Herbie | 2.7 |
if (/.f64 (*.f64 x (+.f64 y z)) z) < -6.58272993913548415e-168Initial program 11.8
Simplified4.0
Taylor expanded in x around 0 4.0
Simplified4.7
if -6.58272993913548415e-168 < (/.f64 (*.f64 x (+.f64 y z)) z) < 1.98164854725029532e98Initial program 7.1
Simplified0.5
Applied egg-rr0.5
if 1.98164854725029532e98 < (/.f64 (*.f64 x (+.f64 y z)) z) < 2.3254757045190749e238Initial program 0.2
if 2.3254757045190749e238 < (/.f64 (*.f64 x (+.f64 y z)) z) Initial program 41.2
Simplified5.1
Applied egg-rr5.1
Applied egg-rr5.1
Final simplification2.7
herbie shell --seed 2022151
(FPCore (x y z)
:name "Numeric.SpecFunctions:choose from math-functions-0.1.5.2"
:precision binary64
:herbie-target
(/ x (/ z (+ y z)))
(/ (* x (+ y z)) z))