(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 z (/ (- x) y) x)))
(if (<= t_0 (- INFINITY))
(fma 1.0 x (/ (- z) (/ y x)))
(if (<= t_0 -2e-272)
(- x (* (/ 1.0 y) (* x z)))
(if (<= t_0 0.0)
t_1
(if (<= t_0 1e+306) (+ x (/ (* x z) (- 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(z, (-x / y), x);
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = fma(1.0, x, (-z / (y / x)));
} else if (t_0 <= -2e-272) {
tmp = x - ((1.0 / y) * (x * z));
} else if (t_0 <= 0.0) {
tmp = t_1;
} else if (t_0 <= 1e+306) {
tmp = x + ((x * z) / -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(z, Float64(Float64(-x) / y), x) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = fma(1.0, x, Float64(Float64(-z) / Float64(y / x))); elseif (t_0 <= -2e-272) tmp = Float64(x - Float64(Float64(1.0 / y) * Float64(x * z))); elseif (t_0 <= 0.0) tmp = t_1; elseif (t_0 <= 1e+306) tmp = Float64(x + Float64(Float64(x * z) / Float64(-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[(z * N[((-x) / y), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(1.0 * x + N[((-z) / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -2e-272], N[(x - N[(N[(1.0 / y), $MachinePrecision] * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], t$95$1, If[LessEqual[t$95$0, 1e+306], N[(x + N[(N[(x * z), $MachinePrecision] / (-y)), $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(z, \frac{-x}{y}, x\right)\\
\mathbf{if}\;t_0 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(1, x, \frac{-z}{\frac{y}{x}}\right)\\
\mathbf{elif}\;t_0 \leq -2 \cdot 10^{-272}:\\
\;\;\;\;x - \frac{1}{y} \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;t_0 \leq 0:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_0 \leq 10^{+306}:\\
\;\;\;\;x + \frac{x \cdot z}{-y}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 12.9 |
|---|---|
| Target | 3.3 |
| Herbie | 0.3 |
if (/.f64 (*.f64 x (-.f64 y z)) y) < -inf.0Initial program 64.0
Simplified0.0
Applied egg-rr21.5
Applied egg-rr0.0
if -inf.0 < (/.f64 (*.f64 x (-.f64 y z)) y) < -1.99999999999999986e-272Initial program 0.4
Simplified6.1
Applied egg-rr0.3
Applied egg-rr0.3
if -1.99999999999999986e-272 < (/.f64 (*.f64 x (-.f64 y z)) y) < 0.0 or 1.00000000000000002e306 < (/.f64 (*.f64 x (-.f64 y z)) y) Initial program 55.1
Simplified0.7
Applied egg-rr0.8
if 0.0 < (/.f64 (*.f64 x (-.f64 y z)) y) < 1.00000000000000002e306Initial program 0.4
Simplified5.5
Applied egg-rr0.3
Applied egg-rr0.3
Final simplification0.3
herbie shell --seed 2022166
(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))