(FPCore (x y z) :precision binary64 (/ (* x (+ y z)) z))
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fma x (/ y z) x)))
(if (<= x -4.639344664532624e+27)
t_0
(if (<= x 1.1771730614040736e-99) (+ x (* y (* x (/ 1.0 z)))) t_0))))double code(double x, double y, double z) {
return (x * (y + z)) / z;
}
double code(double x, double y, double z) {
double t_0 = fma(x, (y / z), x);
double tmp;
if (x <= -4.639344664532624e+27) {
tmp = t_0;
} else if (x <= 1.1771730614040736e-99) {
tmp = x + (y * (x * (1.0 / z)));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) return Float64(Float64(x * Float64(y + z)) / z) end
function code(x, y, z) t_0 = fma(x, Float64(y / z), x) tmp = 0.0 if (x <= -4.639344664532624e+27) tmp = t_0; elseif (x <= 1.1771730614040736e-99) tmp = Float64(x + Float64(y * Float64(x * Float64(1.0 / z)))); else tmp = t_0; 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[(x * N[(y / z), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[x, -4.639344664532624e+27], t$95$0, If[LessEqual[x, 1.1771730614040736e-99], N[(x + N[(y * N[(x * N[(1.0 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\frac{x \cdot \left(y + z\right)}{z}
\begin{array}{l}
t_0 := \mathsf{fma}\left(x, \frac{y}{z}, x\right)\\
\mathbf{if}\;x \leq -4.639344664532624 \cdot 10^{+27}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.1771730614040736 \cdot 10^{-99}:\\
\;\;\;\;x + y \cdot \left(x \cdot \frac{1}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
| Original | 12.4 |
|---|---|
| Target | 3.0 |
| Herbie | 1.7 |
if x < -4.63934466453262382e27 or 1.1771730614040736e-99 < x Initial program 19.8
Simplified0.4
if -4.63934466453262382e27 < x < 1.1771730614040736e-99Initial program 5.4
Simplified5.9
Taylor expanded in y around 0 2.8
Applied egg-rr3.0
Final simplification1.7
herbie shell --seed 2022210
(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))