?

Average Error: 3.2 → 0.4
Time: 7.5s
Precision: binary64
Cost: 1612

?

\[ \begin{array}{c}[y, z] = \mathsf{sort}([y, z])\\ \end{array} \]
\[x \cdot \left(1 - y \cdot z\right) \]
\[\begin{array}{l} t_0 := 1 - y \cdot z\\ \mathbf{if}\;t_0 \leq -5 \cdot 10^{+169}:\\ \;\;\;\;y \cdot \left(\left(-z\right) \cdot x\right)\\ \mathbf{elif}\;t_0 \leq 1.005:\\ \;\;\;\;\frac{x}{\frac{1}{t_0}}\\ \mathbf{elif}\;t_0 \leq 5 \cdot 10^{+194}:\\ \;\;\;\;t_0 \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
 (let* ((t_0 (- 1.0 (* y z))))
   (if (<= t_0 -5e+169)
     (* y (* (- z) x))
     (if (<= t_0 1.005)
       (/ x (/ 1.0 t_0))
       (if (<= t_0 5e+194) (* t_0 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 t_0 = 1.0 - (y * z);
	double tmp;
	if (t_0 <= -5e+169) {
		tmp = y * (-z * x);
	} else if (t_0 <= 1.005) {
		tmp = x / (1.0 / t_0);
	} else if (t_0 <= 5e+194) {
		tmp = t_0 * 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) :: t_0
    real(8) :: tmp
    t_0 = 1.0d0 - (y * z)
    if (t_0 <= (-5d+169)) then
        tmp = y * (-z * x)
    else if (t_0 <= 1.005d0) then
        tmp = x / (1.0d0 / t_0)
    else if (t_0 <= 5d+194) then
        tmp = t_0 * 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 t_0 = 1.0 - (y * z);
	double tmp;
	if (t_0 <= -5e+169) {
		tmp = y * (-z * x);
	} else if (t_0 <= 1.005) {
		tmp = x / (1.0 / t_0);
	} else if (t_0 <= 5e+194) {
		tmp = t_0 * x;
	} else {
		tmp = z * (y * -x);
	}
	return tmp;
}
def code(x, y, z):
	return x * (1.0 - (y * z))
def code(x, y, z):
	t_0 = 1.0 - (y * z)
	tmp = 0
	if t_0 <= -5e+169:
		tmp = y * (-z * x)
	elif t_0 <= 1.005:
		tmp = x / (1.0 / t_0)
	elif t_0 <= 5e+194:
		tmp = t_0 * 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)
	t_0 = Float64(1.0 - Float64(y * z))
	tmp = 0.0
	if (t_0 <= -5e+169)
		tmp = Float64(y * Float64(Float64(-z) * x));
	elseif (t_0 <= 1.005)
		tmp = Float64(x / Float64(1.0 / t_0));
	elseif (t_0 <= 5e+194)
		tmp = Float64(t_0 * 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)
	t_0 = 1.0 - (y * z);
	tmp = 0.0;
	if (t_0 <= -5e+169)
		tmp = y * (-z * x);
	elseif (t_0 <= 1.005)
		tmp = x / (1.0 / t_0);
	elseif (t_0 <= 5e+194)
		tmp = t_0 * 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_] := Block[{t$95$0 = N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e+169], N[(y * N[((-z) * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1.005], N[(x / N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+194], N[(t$95$0 * x), $MachinePrecision], N[(z * N[(y * (-x)), $MachinePrecision]), $MachinePrecision]]]]]
x \cdot \left(1 - y \cdot z\right)
\begin{array}{l}
t_0 := 1 - y \cdot z\\
\mathbf{if}\;t_0 \leq -5 \cdot 10^{+169}:\\
\;\;\;\;y \cdot \left(\left(-z\right) \cdot x\right)\\

\mathbf{elif}\;t_0 \leq 1.005:\\
\;\;\;\;\frac{x}{\frac{1}{t_0}}\\

\mathbf{elif}\;t_0 \leq 5 \cdot 10^{+194}:\\
\;\;\;\;t_0 \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 4 regimes
  2. if (-.f64 1 (*.f64 y z)) < -5.00000000000000017e169

    1. Initial program 20.5

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

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

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

      [Start]2.1

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

      mul-1-neg [=>]2.1

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

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

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

      distribute-lft-neg-in [=>]2.1

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

    if -5.00000000000000017e169 < (-.f64 1 (*.f64 y z)) < 1.0049999999999999

    1. Initial program 0.1

      \[x \cdot \left(1 - y \cdot z\right) \]
    2. Applied egg-rr40.7

      \[\leadsto \color{blue}{\sqrt[3]{{\left(x \cdot \left(1 - y \cdot z\right)\right)}^{3}}} \]
    3. Applied egg-rr0.1

      \[\leadsto \color{blue}{\frac{x}{\frac{1}{1 - y \cdot z}}} \]

    if 1.0049999999999999 < (-.f64 1 (*.f64 y z)) < 4.99999999999999989e194

    1. Initial program 0.3

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

    if 4.99999999999999989e194 < (-.f64 1 (*.f64 y z))

    1. Initial program 26.1

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

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

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

      [Start]2.1

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

      mul-1-neg [=>]2.1

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

      associate-*r* [=>]26.1

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

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

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

      *-commutative [=>]26.1

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

      associate-*l* [=>]2.1

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

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

Alternatives

Alternative 1
Error19.2
Cost1179
\[\begin{array}{l} \mathbf{if}\;y \leq -2.2 \cdot 10^{+125} \lor \neg \left(y \leq -1.75 \cdot 10^{+64} \lor \neg \left(y \leq -5.4 \cdot 10^{+43}\right) \land \left(y \leq -80000 \lor \neg \left(y \leq -2.05 \cdot 10^{-13}\right) \land y \leq 2.55 \cdot 10^{-144}\right)\right):\\ \;\;\;\;x \cdot \left(y \cdot \left(-z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 2
Error1.7
Cost708
\[\begin{array}{l} \mathbf{if}\;y \cdot z \leq -1 \cdot 10^{+198}:\\ \;\;\;\;z \cdot \left(y \cdot \left(-x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(1 - y \cdot z\right) \cdot x\\ \end{array} \]
Alternative 3
Error16.9
Cost649
\[\begin{array}{l} \mathbf{if}\;z \leq -3 \cdot 10^{-127} \lor \neg \left(z \leq 2.2 \cdot 10^{+108}\right):\\ \;\;\;\;y \cdot \left(\left(-z\right) \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 4
Error25.2
Cost64
\[x \]

Error

Reproduce?

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