(FPCore (x y z) :precision binary64 (/ (* x (- y z)) y))
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (* x (- y z)) y)) (t_1 (fma (- x) (/ z y) x)))
(if (<= t_0 (- INFINITY))
(- x (/ x (/ y z)))
(if (<= t_0 -5e+44)
t_0
(if (<= t_0 1e-36)
t_1
(if (<= t_0 1e+292) (+ x (* (/ z (/ 1.0 x)) (/ -1.0 y))) t_1))))))double code(double x, double y, double z) {
return (x * (y - z)) / y;
}
double code(double x, double y, double z) {
double t_0 = (x * (y - z)) / y;
double t_1 = fma(-x, (z / y), x);
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = x - (x / (y / z));
} else if (t_0 <= -5e+44) {
tmp = t_0;
} else if (t_0 <= 1e-36) {
tmp = t_1;
} else if (t_0 <= 1e+292) {
tmp = x + ((z / (1.0 / x)) * (-1.0 / y));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z) return Float64(Float64(x * Float64(y - z)) / y) end
function code(x, y, z) t_0 = Float64(Float64(x * Float64(y - z)) / y) t_1 = fma(Float64(-x), Float64(z / y), x) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(x - Float64(x / Float64(y / z))); elseif (t_0 <= -5e+44) tmp = t_0; elseif (t_0 <= 1e-36) tmp = t_1; elseif (t_0 <= 1e+292) tmp = Float64(x + Float64(Float64(z / Float64(1.0 / x)) * Float64(-1.0 / y))); else tmp = t_1; end return tmp end
code[x_, y_, z_] := N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]}, Block[{t$95$1 = N[((-x) * N[(z / y), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(x - N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -5e+44], t$95$0, If[LessEqual[t$95$0, 1e-36], t$95$1, If[LessEqual[t$95$0, 1e+292], N[(x + N[(N[(z / N[(1.0 / x), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\frac{x \cdot \left(y - z\right)}{y}
\begin{array}{l}
t_0 := \frac{x \cdot \left(y - z\right)}{y}\\
t_1 := \mathsf{fma}\left(-x, \frac{z}{y}, x\right)\\
\mathbf{if}\;t_0 \leq -\infty:\\
\;\;\;\;x - \frac{x}{\frac{y}{z}}\\
\mathbf{elif}\;t_0 \leq -5 \cdot 10^{+44}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;t_0 \leq 10^{-36}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_0 \leq 10^{+292}:\\
\;\;\;\;x + \frac{z}{\frac{1}{x}} \cdot \frac{-1}{y}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
| Original | 12.5 |
|---|---|
| Target | 3.3 |
| Herbie | 0.4 |
if (/.f64 (*.f64 x (-.f64 y z)) y) < -inf.0Initial program 64.0
Simplified0.1
Applied egg-rr22.9
Applied egg-rr0.1
if -inf.0 < (/.f64 (*.f64 x (-.f64 y z)) y) < -4.9999999999999996e44Initial program 0.2
if -4.9999999999999996e44 < (/.f64 (*.f64 x (-.f64 y z)) y) < 9.9999999999999994e-37 or 1e292 < (/.f64 (*.f64 x (-.f64 y z)) y) Initial program 14.4
Simplified3.6
Applied egg-rr6.1
Applied egg-rr0.5
Applied egg-rr0.6
if 9.9999999999999994e-37 < (/.f64 (*.f64 x (-.f64 y z)) y) < 1e292Initial program 0.2
Simplified5.2
Applied egg-rr0.3
Final simplification0.4
herbie shell --seed 2022209
(FPCore (x y z)
:name "Diagrams.Backend.Cairo.Internal:setTexture from diagrams-cairo-1.3.0.3"
:precision binary64
:herbie-target
(if (< z -2.060202331921739e+104) (- x (/ (* z x) y)) (if (< z 1.6939766013828526e+213) (/ x (/ y (- y z))) (* (- y z) (/ x y))))
(/ (* x (- y z)) y))