?

Average Accuracy: 95.0% → 99.4%
Time: 8.7s
Precision: binary64
Cost: 968

?

\[ \begin{array}{c}[y, z] = \mathsf{sort}([y, z])\\ \end{array} \]
\[x \cdot \left(1 - y \cdot z\right) \]
\[\begin{array}{l} \mathbf{if}\;y \cdot z \leq -1 \cdot 10^{+181}:\\ \;\;\;\;\frac{1}{\frac{-1}{y \cdot \left(z \cdot x\right)}}\\ \mathbf{elif}\;y \cdot z \leq 5 \cdot 10^{+169}:\\ \;\;\;\;x - \left(y \cdot z\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(y \cdot \left(-x\right)\right)\\ \end{array} \]
(FPCore (x y z) :precision binary64 (* x (- 1.0 (* y z))))
(FPCore (x y z)
 :precision binary64
 (if (<= (* y z) -1e+181)
   (/ 1.0 (/ -1.0 (* y (* z x))))
   (if (<= (* y z) 5e+169) (- x (* (* y z) x)) (* z (* y (- 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) <= -1e+181) {
		tmp = 1.0 / (-1.0 / (y * (z * x)));
	} else if ((y * z) <= 5e+169) {
		tmp = x - ((y * z) * x);
	} else {
		tmp = z * (y * -x);
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = x * (1.0d0 - (y * z))
end function
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((y * z) <= (-1d+181)) then
        tmp = 1.0d0 / ((-1.0d0) / (y * (z * x)))
    else if ((y * z) <= 5d+169) then
        tmp = x - ((y * z) * x)
    else
        tmp = z * (y * -x)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	return x * (1.0 - (y * z));
}
public static double code(double x, double y, double z) {
	double tmp;
	if ((y * z) <= -1e+181) {
		tmp = 1.0 / (-1.0 / (y * (z * x)));
	} else if ((y * z) <= 5e+169) {
		tmp = x - ((y * z) * x);
	} else {
		tmp = z * (y * -x);
	}
	return tmp;
}
def code(x, y, z):
	return x * (1.0 - (y * z))
def code(x, y, z):
	tmp = 0
	if (y * z) <= -1e+181:
		tmp = 1.0 / (-1.0 / (y * (z * x)))
	elif (y * z) <= 5e+169:
		tmp = x - ((y * z) * x)
	else:
		tmp = z * (y * -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) <= -1e+181)
		tmp = Float64(1.0 / Float64(-1.0 / Float64(y * Float64(z * x))));
	elseif (Float64(y * z) <= 5e+169)
		tmp = Float64(x - Float64(Float64(y * z) * x));
	else
		tmp = Float64(z * Float64(y * Float64(-x)));
	end
	return tmp
end
function tmp = code(x, y, z)
	tmp = x * (1.0 - (y * z));
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((y * z) <= -1e+181)
		tmp = 1.0 / (-1.0 / (y * (z * x)));
	elseif ((y * z) <= 5e+169)
		tmp = x - ((y * z) * x);
	else
		tmp = z * (y * -x);
	end
	tmp_2 = 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], -1e+181], N[(1.0 / N[(-1.0 / N[(y * N[(z * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(y * z), $MachinePrecision], 5e+169], N[(x - N[(N[(y * z), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], N[(z * N[(y * (-x)), $MachinePrecision]), $MachinePrecision]]]
x \cdot \left(1 - y \cdot z\right)
\begin{array}{l}
\mathbf{if}\;y \cdot z \leq -1 \cdot 10^{+181}:\\
\;\;\;\;\frac{1}{\frac{-1}{y \cdot \left(z \cdot x\right)}}\\

\mathbf{elif}\;y \cdot z \leq 5 \cdot 10^{+169}:\\
\;\;\;\;x - \left(y \cdot z\right) \cdot x\\

\mathbf{else}:\\
\;\;\;\;z \cdot \left(y \cdot \left(-x\right)\right)\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Split input into 3 regimes
  2. if (*.f64 y z) < -9.9999999999999992e180

    1. Initial program 62.8%

      \[x \cdot \left(1 - y \cdot z\right) \]
    2. Taylor expanded in x around 0 62.8%

      \[\leadsto \color{blue}{\left(1 - y \cdot z\right) \cdot x} \]
    3. Simplified97.0%

      \[\leadsto \color{blue}{x - y \cdot \left(z \cdot x\right)} \]
      Proof

      [Start]62.8

      \[ \left(1 - y \cdot z\right) \cdot x \]

      *-commutative [<=]62.8

      \[ \color{blue}{x \cdot \left(1 - y \cdot z\right)} \]

      distribute-rgt-out-- [<=]62.8

      \[ \color{blue}{1 \cdot x - \left(y \cdot z\right) \cdot x} \]

      *-lft-identity [=>]62.8

      \[ \color{blue}{x} - \left(y \cdot z\right) \cdot x \]

      associate-*r* [<=]97.0

      \[ x - \color{blue}{y \cdot \left(z \cdot x\right)} \]
    4. Applied egg-rr48.9%

      \[\leadsto \color{blue}{\frac{1}{\frac{x + y \cdot \left(z \cdot x\right)}{x \cdot x - {\left(y \cdot \left(z \cdot x\right)\right)}^{2}}}} \]
      Proof

      [Start]97.0

      \[ x - y \cdot \left(z \cdot x\right) \]

      flip-- [=>]49.1

      \[ \color{blue}{\frac{x \cdot x - \left(y \cdot \left(z \cdot x\right)\right) \cdot \left(y \cdot \left(z \cdot x\right)\right)}{x + y \cdot \left(z \cdot x\right)}} \]

      clear-num [=>]48.9

      \[ \color{blue}{\frac{1}{\frac{x + y \cdot \left(z \cdot x\right)}{x \cdot x - \left(y \cdot \left(z \cdot x\right)\right) \cdot \left(y \cdot \left(z \cdot x\right)\right)}}} \]

      pow2 [=>]48.9

      \[ \frac{1}{\frac{x + y \cdot \left(z \cdot x\right)}{x \cdot x - \color{blue}{{\left(y \cdot \left(z \cdot x\right)\right)}^{2}}}} \]
    5. Taylor expanded in y around inf 96.8%

      \[\leadsto \frac{1}{\color{blue}{\frac{-1}{y \cdot \left(z \cdot x\right)}}} \]

    if -9.9999999999999992e180 < (*.f64 y z) < 5.00000000000000017e169

    1. Initial program 99.9%

      \[x \cdot \left(1 - y \cdot z\right) \]
    2. Taylor expanded in x around 0 99.9%

      \[\leadsto \color{blue}{\left(1 - y \cdot z\right) \cdot x} \]
    3. Simplified91.7%

      \[\leadsto \color{blue}{x - y \cdot \left(z \cdot x\right)} \]
      Proof

      [Start]99.9

      \[ \left(1 - y \cdot z\right) \cdot x \]

      *-commutative [<=]99.9

      \[ \color{blue}{x \cdot \left(1 - y \cdot z\right)} \]

      distribute-rgt-out-- [<=]99.9

      \[ \color{blue}{1 \cdot x - \left(y \cdot z\right) \cdot x} \]

      *-lft-identity [=>]99.9

      \[ \color{blue}{x} - \left(y \cdot z\right) \cdot x \]

      associate-*r* [<=]91.7

      \[ x - \color{blue}{y \cdot \left(z \cdot x\right)} \]
    4. Applied egg-rr68.5%

      \[\leadsto x - \color{blue}{\left(e^{\mathsf{log1p}\left(y \cdot \left(z \cdot x\right)\right)} - 1\right)} \]
      Proof

      [Start]91.7

      \[ x - y \cdot \left(z \cdot x\right) \]

      expm1-log1p-u [=>]78.0

      \[ x - \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(y \cdot \left(z \cdot x\right)\right)\right)} \]

      expm1-udef [=>]68.5

      \[ x - \color{blue}{\left(e^{\mathsf{log1p}\left(y \cdot \left(z \cdot x\right)\right)} - 1\right)} \]
    5. Simplified99.9%

      \[\leadsto x - \color{blue}{\left(y \cdot z\right) \cdot x} \]
      Proof

      [Start]68.5

      \[ x - \left(e^{\mathsf{log1p}\left(y \cdot \left(z \cdot x\right)\right)} - 1\right) \]

      expm1-def [=>]78.0

      \[ x - \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(y \cdot \left(z \cdot x\right)\right)\right)} \]

      expm1-log1p [=>]91.7

      \[ x - \color{blue}{y \cdot \left(z \cdot x\right)} \]

      associate-*r* [=>]99.9

      \[ x - \color{blue}{\left(y \cdot z\right) \cdot x} \]

    if 5.00000000000000017e169 < (*.f64 y z)

    1. Initial program 67.0%

      \[x \cdot \left(1 - y \cdot z\right) \]
    2. Taylor expanded in y around inf 97.2%

      \[\leadsto \color{blue}{-1 \cdot \left(y \cdot \left(z \cdot x\right)\right)} \]
    3. Simplified96.1%

      \[\leadsto \color{blue}{z \cdot \left(y \cdot \left(-x\right)\right)} \]
      Proof

      [Start]97.2

      \[ -1 \cdot \left(y \cdot \left(z \cdot x\right)\right) \]

      mul-1-neg [=>]97.2

      \[ \color{blue}{-y \cdot \left(z \cdot x\right)} \]

      associate-*r* [=>]67.0

      \[ -\color{blue}{\left(y \cdot z\right) \cdot x} \]

      distribute-rgt-neg-in [=>]67.0

      \[ \color{blue}{\left(y \cdot z\right) \cdot \left(-x\right)} \]

      *-commutative [=>]67.0

      \[ \color{blue}{\left(z \cdot y\right)} \cdot \left(-x\right) \]

      associate-*l* [=>]96.1

      \[ \color{blue}{z \cdot \left(y \cdot \left(-x\right)\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification99.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot z \leq -1 \cdot 10^{+181}:\\ \;\;\;\;\frac{1}{\frac{-1}{y \cdot \left(z \cdot x\right)}}\\ \mathbf{elif}\;y \cdot z \leq 5 \cdot 10^{+169}:\\ \;\;\;\;x - \left(y \cdot z\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(y \cdot \left(-x\right)\right)\\ \end{array} \]

Alternatives

Alternative 1
Accuracy99.2%
Cost968
\[\begin{array}{l} \mathbf{if}\;y \cdot z \leq -5 \cdot 10^{+134}:\\ \;\;\;\;y \cdot \left(z \cdot \left(-x\right)\right)\\ \mathbf{elif}\;y \cdot z \leq 5 \cdot 10^{+169}:\\ \;\;\;\;x \cdot \left(1 - y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(y \cdot \left(-x\right)\right)\\ \end{array} \]
Alternative 2
Accuracy99.2%
Cost968
\[\begin{array}{l} \mathbf{if}\;y \cdot z \leq -5 \cdot 10^{+134}:\\ \;\;\;\;y \cdot \left(z \cdot \left(-x\right)\right)\\ \mathbf{elif}\;y \cdot z \leq 5 \cdot 10^{+169}:\\ \;\;\;\;x - \left(y \cdot z\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(y \cdot \left(-x\right)\right)\\ \end{array} \]
Alternative 3
Accuracy70.1%
Cost649
\[\begin{array}{l} \mathbf{if}\;z \leq -2.06 \cdot 10^{-156} \lor \neg \left(z \leq 10^{+63}\right):\\ \;\;\;\;x \cdot \left(z \cdot \left(-y\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 4
Accuracy73.1%
Cost649
\[\begin{array}{l} \mathbf{if}\;z \leq -9 \cdot 10^{-80} \lor \neg \left(z \leq 1.36 \cdot 10^{+63}\right):\\ \;\;\;\;y \cdot \left(z \cdot \left(-x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 5
Accuracy60.5%
Cost64
\[x \]

Error

Reproduce?

herbie shell --seed 2023143 
(FPCore (x y z)
  :name "Data.Colour.RGBSpace.HSV:hsv from colour-2.3.3, I"
  :precision binary64
  (* x (- 1.0 (* y z))))