(FPCore (x y z) :precision binary64 (/ (* x (- y z)) y))
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fma (/ (- z) y) x x)))
(if (<= x -1e+92)
t_0
(if (<= x 8.829242912010182e-304)
(fma z (/ (- x) y) x)
(if (<= x 4.142754075651002e-166)
(- x (/ (* x z) y))
(if (<= x 1.9913091815903685e-11) (- x (/ z (/ y x))) t_0))))))double code(double x, double y, double z) {
return (x * (y - z)) / y;
}
double code(double x, double y, double z) {
double t_0 = fma((-z / y), x, x);
double tmp;
if (x <= -1e+92) {
tmp = t_0;
} else if (x <= 8.829242912010182e-304) {
tmp = fma(z, (-x / y), x);
} else if (x <= 4.142754075651002e-166) {
tmp = x - ((x * z) / y);
} else if (x <= 1.9913091815903685e-11) {
tmp = x - (z / (y / x));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) return Float64(Float64(x * Float64(y - z)) / y) end
function code(x, y, z) t_0 = fma(Float64(Float64(-z) / y), x, x) tmp = 0.0 if (x <= -1e+92) tmp = t_0; elseif (x <= 8.829242912010182e-304) tmp = fma(z, Float64(Float64(-x) / y), x); elseif (x <= 4.142754075651002e-166) tmp = Float64(x - Float64(Float64(x * z) / y)); elseif (x <= 1.9913091815903685e-11) tmp = Float64(x - Float64(z / Float64(y / x))); else tmp = t_0; 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[((-z) / y), $MachinePrecision] * x + x), $MachinePrecision]}, If[LessEqual[x, -1e+92], t$95$0, If[LessEqual[x, 8.829242912010182e-304], N[(z * N[((-x) / y), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[x, 4.142754075651002e-166], N[(x - N[(N[(x * z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.9913091815903685e-11], N[(x - N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\frac{x \cdot \left(y - z\right)}{y}
\begin{array}{l}
t_0 := \mathsf{fma}\left(\frac{-z}{y}, x, x\right)\\
\mathbf{if}\;x \leq -1 \cdot 10^{+92}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 8.829242912010182 \cdot 10^{-304}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{-x}{y}, x\right)\\
\mathbf{elif}\;x \leq 4.142754075651002 \cdot 10^{-166}:\\
\;\;\;\;x - \frac{x \cdot z}{y}\\
\mathbf{elif}\;x \leq 1.9913091815903685 \cdot 10^{-11}:\\
\;\;\;\;x - \frac{z}{\frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
| Original | 12.1 |
|---|---|
| Target | 3.1 |
| Herbie | 1.8 |
if x < -1e92 or 1.9913091815903685e-11 < x Initial program 24.2
Simplified8.1
Applied egg-rr0.1
if -1e92 < x < 8.8292429120101816e-304Initial program 5.4
Simplified3.0
Applied egg-rr3.0
if 8.8292429120101816e-304 < x < 4.1427540756510021e-166Initial program 8.2
Simplified4.0
Taylor expanded in z around 0 4.0
if 4.1427540756510021e-166 < x < 1.9913091815903685e-11Initial program 1.9
Simplified1.1
Final simplification1.8
herbie shell --seed 2022211
(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))