(FPCore (x y z) :precision binary64 (/ (* x (+ y z)) z))
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (* x (+ y z)) z)) (t_1 (+ x (* x (/ y z)))))
(if (<= t_0 (- INFINITY))
t_1
(if (<= t_0 -4.661980180955999e+60)
t_0
(if (<= t_0 2.253742551394457e+51)
(fma x (/ y z) x)
(if (<= t_0 7.1520811241619215e+298) t_0 t_1))))))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 t_1 = x + (x * (y / z));
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_0 <= -4.661980180955999e+60) {
tmp = t_0;
} else if (t_0 <= 2.253742551394457e+51) {
tmp = fma(x, (y / z), x);
} else if (t_0 <= 7.1520811241619215e+298) {
tmp = t_0;
} else {
tmp = t_1;
}
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) t_1 = Float64(x + Float64(x * Float64(y / z))) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = t_1; elseif (t_0 <= -4.661980180955999e+60) tmp = t_0; elseif (t_0 <= 2.253742551394457e+51) tmp = fma(x, Float64(y / z), x); elseif (t_0 <= 7.1520811241619215e+298) tmp = t_0; else tmp = t_1; 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]}, Block[{t$95$1 = N[(x + N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], t$95$1, If[LessEqual[t$95$0, -4.661980180955999e+60], t$95$0, If[LessEqual[t$95$0, 2.253742551394457e+51], N[(x * N[(y / z), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$0, 7.1520811241619215e+298], t$95$0, t$95$1]]]]]]
\frac{x \cdot \left(y + z\right)}{z}
\begin{array}{l}
t_0 := \frac{x \cdot \left(y + z\right)}{z}\\
t_1 := x + x \cdot \frac{y}{z}\\
\mathbf{if}\;t_0 \leq -\infty:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_0 \leq -4.661980180955999 \cdot 10^{+60}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;t_0 \leq 2.253742551394457 \cdot 10^{+51}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{y}{z}, x\right)\\
\mathbf{elif}\;t_0 \leq 7.1520811241619215 \cdot 10^{+298}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 12.7 |
|---|---|
| Target | 3.0 |
| Herbie | 0.3 |
if (/.f64 (*.f64 x (+.f64 y z)) z) < -inf.0 or 7.15208112416192148e298 < (/.f64 (*.f64 x (+.f64 y z)) z) Initial program 62.3
Simplified0.6
Applied fma-udef_binary640.6
if -inf.0 < (/.f64 (*.f64 x (+.f64 y z)) z) < -4.6619801809559989e60 or 2.25374255139445716e51 < (/.f64 (*.f64 x (+.f64 y z)) z) < 7.15208112416192148e298Initial program 0.2
if -4.6619801809559989e60 < (/.f64 (*.f64 x (+.f64 y z)) z) < 2.25374255139445716e51Initial program 5.4
Simplified0.3
Final simplification0.3
herbie shell --seed 2022131
(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))