| Alternative 1 | |
|---|---|
| Accuracy | 99.6% |
| Cost | 1224 |
(FPCore (x y z) :precision binary64 (* x (- 1.0 (* y z))))
(FPCore (x y z)
:precision binary64
(if (<= (* y z) -2e+245)
(* z (* y (- x)))
(if (<= (* y z) 5e+148)
(* x (fma z (- y) 1.0))
(/ 1.0 (/ 1.0 (- x (* y (* z x))))))))double code(double x, double y, double z) {
return x * (1.0 - (y * z));
}
double code(double x, double y, double z) {
double tmp;
if ((y * z) <= -2e+245) {
tmp = z * (y * -x);
} else if ((y * z) <= 5e+148) {
tmp = x * fma(z, -y, 1.0);
} else {
tmp = 1.0 / (1.0 / (x - (y * (z * x))));
}
return tmp;
}
function code(x, y, z) return Float64(x * Float64(1.0 - Float64(y * z))) end
function code(x, y, z) tmp = 0.0 if (Float64(y * z) <= -2e+245) tmp = Float64(z * Float64(y * Float64(-x))); elseif (Float64(y * z) <= 5e+148) tmp = Float64(x * fma(z, Float64(-y), 1.0)); else tmp = Float64(1.0 / Float64(1.0 / Float64(x - Float64(y * Float64(z * x))))); end return tmp end
code[x_, y_, z_] := N[(x * N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_] := If[LessEqual[N[(y * z), $MachinePrecision], -2e+245], N[(z * N[(y * (-x)), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(y * z), $MachinePrecision], 5e+148], N[(x * N[(z * (-y) + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(1.0 / N[(x - N[(y * N[(z * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
x \cdot \left(1 - y \cdot z\right)
\begin{array}{l}
\mathbf{if}\;y \cdot z \leq -2 \cdot 10^{+245}:\\
\;\;\;\;z \cdot \left(y \cdot \left(-x\right)\right)\\
\mathbf{elif}\;y \cdot z \leq 5 \cdot 10^{+148}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(z, -y, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{1}{x - y \cdot \left(z \cdot x\right)}}\\
\end{array}
if (*.f64 y z) < -2.00000000000000009e245Initial program 45.2%
Taylor expanded in y around inf 99.1%
Simplified99.3%
[Start]99.1 | \[ -1 \cdot \left(y \cdot \left(z \cdot x\right)\right)
\] |
|---|---|
mul-1-neg [=>]99.1 | \[ \color{blue}{-y \cdot \left(z \cdot x\right)}
\] |
*-commutative [=>]99.1 | \[ -\color{blue}{\left(z \cdot x\right) \cdot y}
\] |
associate-*l* [=>]99.3 | \[ -\color{blue}{z \cdot \left(x \cdot y\right)}
\] |
distribute-rgt-neg-in [=>]99.3 | \[ \color{blue}{z \cdot \left(-x \cdot y\right)}
\] |
*-commutative [<=]99.3 | \[ z \cdot \left(-\color{blue}{y \cdot x}\right)
\] |
distribute-rgt-neg-in [=>]99.3 | \[ z \cdot \color{blue}{\left(y \cdot \left(-x\right)\right)}
\] |
if -2.00000000000000009e245 < (*.f64 y z) < 5.00000000000000024e148Initial program 99.9%
Simplified99.9%
[Start]99.9 | \[ x \cdot \left(1 - y \cdot z\right)
\] |
|---|---|
cancel-sign-sub-inv [=>]99.9 | \[ x \cdot \color{blue}{\left(1 + \left(-y\right) \cdot z\right)}
\] |
+-commutative [=>]99.9 | \[ x \cdot \color{blue}{\left(\left(-y\right) \cdot z + 1\right)}
\] |
*-commutative [=>]99.9 | \[ x \cdot \left(\color{blue}{z \cdot \left(-y\right)} + 1\right)
\] |
fma-def [=>]99.9 | \[ x \cdot \color{blue}{\mathsf{fma}\left(z, -y, 1\right)}
\] |
if 5.00000000000000024e148 < (*.f64 y z) Initial program 70.9%
Taylor expanded in x around 0 70.9%
Simplified95.3%
[Start]70.9 | \[ \left(1 - y \cdot z\right) \cdot x
\] |
|---|---|
*-commutative [=>]70.9 | \[ \color{blue}{x \cdot \left(1 - y \cdot z\right)}
\] |
distribute-rgt-out-- [<=]70.9 | \[ \color{blue}{1 \cdot x - \left(y \cdot z\right) \cdot x}
\] |
*-lft-identity [=>]70.9 | \[ \color{blue}{x} - \left(y \cdot z\right) \cdot x
\] |
*-commutative [=>]70.9 | \[ x - \color{blue}{\left(z \cdot y\right)} \cdot x
\] |
associate-*l* [=>]95.3 | \[ x - \color{blue}{z \cdot \left(y \cdot x\right)}
\] |
Applied egg-rr93.7%
[Start]95.3 | \[ x - z \cdot \left(y \cdot x\right)
\] |
|---|---|
add-cube-cbrt [=>]93.7 | \[ \color{blue}{\left(\sqrt[3]{x - z \cdot \left(y \cdot x\right)} \cdot \sqrt[3]{x - z \cdot \left(y \cdot x\right)}\right) \cdot \sqrt[3]{x - z \cdot \left(y \cdot x\right)}}
\] |
pow3 [=>]93.7 | \[ \color{blue}{{\left(\sqrt[3]{x - z \cdot \left(y \cdot x\right)}\right)}^{3}}
\] |
Applied egg-rr97.1%
[Start]93.7 | \[ {\left(\sqrt[3]{x - z \cdot \left(y \cdot x\right)}\right)}^{3}
\] |
|---|---|
rem-cube-cbrt [=>]95.3 | \[ \color{blue}{x - z \cdot \left(y \cdot x\right)}
\] |
flip-- [=>]48.0 | \[ \color{blue}{\frac{x \cdot x - \left(z \cdot \left(y \cdot x\right)\right) \cdot \left(z \cdot \left(y \cdot x\right)\right)}{x + z \cdot \left(y \cdot x\right)}}
\] |
clear-num [=>]47.9 | \[ \color{blue}{\frac{1}{\frac{x + z \cdot \left(y \cdot x\right)}{x \cdot x - \left(z \cdot \left(y \cdot x\right)\right) \cdot \left(z \cdot \left(y \cdot x\right)\right)}}}
\] |
*-un-lft-identity [=>]47.9 | \[ \frac{1}{\frac{\color{blue}{1 \cdot \left(x + z \cdot \left(y \cdot x\right)\right)}}{x \cdot x - \left(z \cdot \left(y \cdot x\right)\right) \cdot \left(z \cdot \left(y \cdot x\right)\right)}}
\] |
associate-/l* [=>]48.0 | \[ \frac{1}{\color{blue}{\frac{1}{\frac{x \cdot x - \left(z \cdot \left(y \cdot x\right)\right) \cdot \left(z \cdot \left(y \cdot x\right)\right)}{x + z \cdot \left(y \cdot x\right)}}}}
\] |
flip-- [<=]95.2 | \[ \frac{1}{\frac{1}{\color{blue}{x - z \cdot \left(y \cdot x\right)}}}
\] |
*-commutative [=>]95.2 | \[ \frac{1}{\frac{1}{x - \color{blue}{\left(y \cdot x\right) \cdot z}}}
\] |
associate-*l* [=>]97.1 | \[ \frac{1}{\frac{1}{x - \color{blue}{y \cdot \left(x \cdot z\right)}}}
\] |
Final simplification99.6%
| Alternative 1 | |
|---|---|
| Accuracy | 99.6% |
| Cost | 1224 |
| Alternative 2 | |
|---|---|
| Accuracy | 99.6% |
| Cost | 968 |
| Alternative 3 | |
|---|---|
| Accuracy | 71.5% |
| Cost | 914 |
| Alternative 4 | |
|---|---|
| Accuracy | 73.3% |
| Cost | 912 |
| Alternative 5 | |
|---|---|
| Accuracy | 72.7% |
| Cost | 912 |
| Alternative 6 | |
|---|---|
| Accuracy | 60.5% |
| Cost | 64 |
herbie shell --seed 2023138
(FPCore (x y z)
:name "Data.Colour.RGBSpace.HSV:hsv from colour-2.3.3, I"
:precision binary64
(* x (- 1.0 (* y z))))