Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, D

Percentage Accurate: 99.5% → 99.8%
Time: 10.8s
Alternatives: 13
Speedup: 1.2×

Specification

?
\[\begin{array}{l} \\ x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \end{array} \]
(FPCore (x y z)
 :precision binary64
 (+ x (* (* (- y x) 6.0) (- (/ 2.0 3.0) z))))
double code(double x, double y, double z) {
	return x + (((y - x) * 6.0) * ((2.0 / 3.0) - z));
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = x + (((y - x) * 6.0d0) * ((2.0d0 / 3.0d0) - z))
end function
public static double code(double x, double y, double z) {
	return x + (((y - x) * 6.0) * ((2.0 / 3.0) - z));
}
def code(x, y, z):
	return x + (((y - x) * 6.0) * ((2.0 / 3.0) - z))
function code(x, y, z)
	return Float64(x + Float64(Float64(Float64(y - x) * 6.0) * Float64(Float64(2.0 / 3.0) - z)))
end
function tmp = code(x, y, z)
	tmp = x + (((y - x) * 6.0) * ((2.0 / 3.0) - z));
end
code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * N[(N[(2.0 / 3.0), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right)
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 13 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 99.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \end{array} \]
(FPCore (x y z)
 :precision binary64
 (+ x (* (* (- y x) 6.0) (- (/ 2.0 3.0) z))))
double code(double x, double y, double z) {
	return x + (((y - x) * 6.0) * ((2.0 / 3.0) - z));
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = x + (((y - x) * 6.0d0) * ((2.0d0 / 3.0d0) - z))
end function
public static double code(double x, double y, double z) {
	return x + (((y - x) * 6.0) * ((2.0 / 3.0) - z));
}
def code(x, y, z):
	return x + (((y - x) * 6.0) * ((2.0 / 3.0) - z))
function code(x, y, z)
	return Float64(x + Float64(Float64(Float64(y - x) * 6.0) * Float64(Float64(2.0 / 3.0) - z)))
end
function tmp = code(x, y, z)
	tmp = x + (((y - x) * 6.0) * ((2.0 / 3.0) - z));
end
code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * N[(N[(2.0 / 3.0), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right)
\end{array}

Alternative 1: 99.8% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(y - x, 4 + z \cdot -6, x\right) \end{array} \]
(FPCore (x y z) :precision binary64 (fma (- y x) (+ 4.0 (* z -6.0)) x))
double code(double x, double y, double z) {
	return fma((y - x), (4.0 + (z * -6.0)), x);
}
function code(x, y, z)
	return fma(Float64(y - x), Float64(4.0 + Float64(z * -6.0)), x)
end
code[x_, y_, z_] := N[(N[(y - x), $MachinePrecision] * N[(4.0 + N[(z * -6.0), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(y - x, 4 + z \cdot -6, x\right)
\end{array}
Derivation
  1. Initial program 99.2%

    \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
  2. Step-by-step derivation
    1. +-commutative99.2%

      \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) + x} \]
    2. associate-*l*99.8%

      \[\leadsto \color{blue}{\left(y - x\right) \cdot \left(6 \cdot \left(\frac{2}{3} - z\right)\right)} + x \]
    3. fma-define99.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, 6 \cdot \left(\frac{2}{3} - z\right), x\right)} \]
    4. sub-neg99.8%

      \[\leadsto \mathsf{fma}\left(y - x, 6 \cdot \color{blue}{\left(\frac{2}{3} + \left(-z\right)\right)}, x\right) \]
    5. distribute-rgt-in99.8%

      \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\frac{2}{3} \cdot 6 + \left(-z\right) \cdot 6}, x\right) \]
    6. metadata-eval99.8%

      \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{0.6666666666666666} \cdot 6 + \left(-z\right) \cdot 6, x\right) \]
    7. metadata-eval99.8%

      \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{4} + \left(-z\right) \cdot 6, x\right) \]
    8. distribute-lft-neg-out99.8%

      \[\leadsto \mathsf{fma}\left(y - x, 4 + \color{blue}{\left(-z \cdot 6\right)}, x\right) \]
    9. distribute-rgt-neg-in99.8%

      \[\leadsto \mathsf{fma}\left(y - x, 4 + \color{blue}{z \cdot \left(-6\right)}, x\right) \]
    10. metadata-eval99.8%

      \[\leadsto \mathsf{fma}\left(y - x, 4 + z \cdot \color{blue}{-6}, x\right) \]
  3. Simplified99.8%

    \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, 4 + z \cdot -6, x\right)} \]
  4. Add Preprocessing
  5. Add Preprocessing

Alternative 2: 49.6% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -0.0048:\\ \;\;\;\;z \cdot \left(x \cdot 6\right)\\ \mathbf{elif}\;z \leq -9.2 \cdot 10^{-32}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -7.2 \cdot 10^{-151}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -9 \cdot 10^{-207}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 2.4 \cdot 10^{-275}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 800000:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= z -0.0048)
   (* z (* x 6.0))
   (if (<= z -9.2e-32)
     (* x -3.0)
     (if (<= z -7.2e-151)
       (* y 4.0)
       (if (<= z -9e-207)
         (* x -3.0)
         (if (<= z 2.4e-275)
           (* y 4.0)
           (if (<= z 800000.0) (* x -3.0) (* x (* z 6.0)))))))))
double code(double x, double y, double z) {
	double tmp;
	if (z <= -0.0048) {
		tmp = z * (x * 6.0);
	} else if (z <= -9.2e-32) {
		tmp = x * -3.0;
	} else if (z <= -7.2e-151) {
		tmp = y * 4.0;
	} else if (z <= -9e-207) {
		tmp = x * -3.0;
	} else if (z <= 2.4e-275) {
		tmp = y * 4.0;
	} else if (z <= 800000.0) {
		tmp = x * -3.0;
	} else {
		tmp = x * (z * 6.0);
	}
	return tmp;
}
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 (z <= (-0.0048d0)) then
        tmp = z * (x * 6.0d0)
    else if (z <= (-9.2d-32)) then
        tmp = x * (-3.0d0)
    else if (z <= (-7.2d-151)) then
        tmp = y * 4.0d0
    else if (z <= (-9d-207)) then
        tmp = x * (-3.0d0)
    else if (z <= 2.4d-275) then
        tmp = y * 4.0d0
    else if (z <= 800000.0d0) then
        tmp = x * (-3.0d0)
    else
        tmp = x * (z * 6.0d0)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -0.0048) {
		tmp = z * (x * 6.0);
	} else if (z <= -9.2e-32) {
		tmp = x * -3.0;
	} else if (z <= -7.2e-151) {
		tmp = y * 4.0;
	} else if (z <= -9e-207) {
		tmp = x * -3.0;
	} else if (z <= 2.4e-275) {
		tmp = y * 4.0;
	} else if (z <= 800000.0) {
		tmp = x * -3.0;
	} else {
		tmp = x * (z * 6.0);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if z <= -0.0048:
		tmp = z * (x * 6.0)
	elif z <= -9.2e-32:
		tmp = x * -3.0
	elif z <= -7.2e-151:
		tmp = y * 4.0
	elif z <= -9e-207:
		tmp = x * -3.0
	elif z <= 2.4e-275:
		tmp = y * 4.0
	elif z <= 800000.0:
		tmp = x * -3.0
	else:
		tmp = x * (z * 6.0)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (z <= -0.0048)
		tmp = Float64(z * Float64(x * 6.0));
	elseif (z <= -9.2e-32)
		tmp = Float64(x * -3.0);
	elseif (z <= -7.2e-151)
		tmp = Float64(y * 4.0);
	elseif (z <= -9e-207)
		tmp = Float64(x * -3.0);
	elseif (z <= 2.4e-275)
		tmp = Float64(y * 4.0);
	elseif (z <= 800000.0)
		tmp = Float64(x * -3.0);
	else
		tmp = Float64(x * Float64(z * 6.0));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -0.0048)
		tmp = z * (x * 6.0);
	elseif (z <= -9.2e-32)
		tmp = x * -3.0;
	elseif (z <= -7.2e-151)
		tmp = y * 4.0;
	elseif (z <= -9e-207)
		tmp = x * -3.0;
	elseif (z <= 2.4e-275)
		tmp = y * 4.0;
	elseif (z <= 800000.0)
		tmp = x * -3.0;
	else
		tmp = x * (z * 6.0);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[z, -0.0048], N[(z * N[(x * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -9.2e-32], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, -7.2e-151], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, -9e-207], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 2.4e-275], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 800000.0], N[(x * -3.0), $MachinePrecision], N[(x * N[(z * 6.0), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.0048:\\
\;\;\;\;z \cdot \left(x \cdot 6\right)\\

\mathbf{elif}\;z \leq -9.2 \cdot 10^{-32}:\\
\;\;\;\;x \cdot -3\\

\mathbf{elif}\;z \leq -7.2 \cdot 10^{-151}:\\
\;\;\;\;y \cdot 4\\

\mathbf{elif}\;z \leq -9 \cdot 10^{-207}:\\
\;\;\;\;x \cdot -3\\

\mathbf{elif}\;z \leq 2.4 \cdot 10^{-275}:\\
\;\;\;\;y \cdot 4\\

\mathbf{elif}\;z \leq 800000:\\
\;\;\;\;x \cdot -3\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -0.00479999999999999958

    1. Initial program 99.7%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Step-by-step derivation
      1. metadata-eval99.7%

        \[\leadsto x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\color{blue}{0.6666666666666666} - z\right) \]
    3. Simplified99.7%

      \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 51.8%

      \[\leadsto \color{blue}{x \cdot \left(1 + -6 \cdot \left(0.6666666666666666 - z\right)\right)} \]
    6. Step-by-step derivation
      1. metadata-eval51.8%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6\right)} \cdot \left(0.6666666666666666 - z\right)\right) \]
      2. cancel-sign-sub-inv51.8%

        \[\leadsto x \cdot \color{blue}{\left(1 - 6 \cdot \left(0.6666666666666666 - z\right)\right)} \]
      3. *-commutative51.8%

        \[\leadsto x \cdot \left(1 - \color{blue}{\left(0.6666666666666666 - z\right) \cdot 6}\right) \]
      4. cancel-sign-sub-inv51.8%

        \[\leadsto x \cdot \color{blue}{\left(1 + \left(-\left(0.6666666666666666 - z\right)\right) \cdot 6\right)} \]
      5. distribute-lft-neg-in51.8%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-\left(0.6666666666666666 - z\right) \cdot 6\right)}\right) \]
      6. *-commutative51.8%

        \[\leadsto x \cdot \left(1 + \left(-\color{blue}{6 \cdot \left(0.6666666666666666 - z\right)}\right)\right) \]
      7. sub-neg51.8%

        \[\leadsto x \cdot \left(1 + \left(-6 \cdot \color{blue}{\left(0.6666666666666666 + \left(-z\right)\right)}\right)\right) \]
      8. distribute-lft-in51.8%

        \[\leadsto x \cdot \left(1 + \left(-\color{blue}{\left(6 \cdot 0.6666666666666666 + 6 \cdot \left(-z\right)\right)}\right)\right) \]
      9. metadata-eval51.8%

        \[\leadsto x \cdot \left(1 + \left(-\left(\color{blue}{4} + 6 \cdot \left(-z\right)\right)\right)\right) \]
      10. distribute-rgt-neg-out51.8%

        \[\leadsto x \cdot \left(1 + \left(-\left(4 + \color{blue}{\left(-6 \cdot z\right)}\right)\right)\right) \]
      11. distribute-lft-neg-in51.8%

        \[\leadsto x \cdot \left(1 + \left(-\left(4 + \color{blue}{\left(-6\right) \cdot z}\right)\right)\right) \]
      12. metadata-eval51.8%

        \[\leadsto x \cdot \left(1 + \left(-\left(4 + \color{blue}{-6} \cdot z\right)\right)\right) \]
      13. mul-1-neg51.8%

        \[\leadsto x \cdot \left(1 + \color{blue}{-1 \cdot \left(4 + -6 \cdot z\right)}\right) \]
      14. distribute-lft-in51.8%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-1 \cdot 4 + -1 \cdot \left(-6 \cdot z\right)\right)}\right) \]
      15. metadata-eval51.8%

        \[\leadsto x \cdot \left(1 + \left(\color{blue}{-4} + -1 \cdot \left(-6 \cdot z\right)\right)\right) \]
      16. associate-+r+51.8%

        \[\leadsto x \cdot \color{blue}{\left(\left(1 + -4\right) + -1 \cdot \left(-6 \cdot z\right)\right)} \]
      17. metadata-eval51.8%

        \[\leadsto x \cdot \left(\color{blue}{-3} + -1 \cdot \left(-6 \cdot z\right)\right) \]
      18. associate-*r*51.8%

        \[\leadsto x \cdot \left(-3 + \color{blue}{\left(-1 \cdot -6\right) \cdot z}\right) \]
      19. metadata-eval51.8%

        \[\leadsto x \cdot \left(-3 + \color{blue}{6} \cdot z\right) \]
      20. *-commutative51.8%

        \[\leadsto x \cdot \left(-3 + \color{blue}{z \cdot 6}\right) \]
    7. Simplified51.8%

      \[\leadsto \color{blue}{x \cdot \left(-3 + z \cdot 6\right)} \]
    8. Taylor expanded in z around 0 51.8%

      \[\leadsto \color{blue}{-3 \cdot x + 6 \cdot \left(x \cdot z\right)} \]
    9. Taylor expanded in z around inf 50.1%

      \[\leadsto \color{blue}{6 \cdot \left(x \cdot z\right)} \]
    10. Step-by-step derivation
      1. *-commutative50.1%

        \[\leadsto \color{blue}{\left(x \cdot z\right) \cdot 6} \]
      2. *-commutative50.1%

        \[\leadsto \color{blue}{\left(z \cdot x\right)} \cdot 6 \]
      3. associate-*r*50.1%

        \[\leadsto \color{blue}{z \cdot \left(x \cdot 6\right)} \]
    11. Simplified50.1%

      \[\leadsto \color{blue}{z \cdot \left(x \cdot 6\right)} \]

    if -0.00479999999999999958 < z < -9.2000000000000002e-32 or -7.20000000000000064e-151 < z < -8.99999999999999984e-207 or 2.39999999999999991e-275 < z < 8e5

    1. Initial program 99.2%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Step-by-step derivation
      1. metadata-eval99.2%

        \[\leadsto x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\color{blue}{0.6666666666666666} - z\right) \]
    3. Simplified99.2%

      \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 68.1%

      \[\leadsto \color{blue}{x \cdot \left(1 + -6 \cdot \left(0.6666666666666666 - z\right)\right)} \]
    6. Step-by-step derivation
      1. metadata-eval68.1%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6\right)} \cdot \left(0.6666666666666666 - z\right)\right) \]
      2. cancel-sign-sub-inv68.1%

        \[\leadsto x \cdot \color{blue}{\left(1 - 6 \cdot \left(0.6666666666666666 - z\right)\right)} \]
      3. *-commutative68.1%

        \[\leadsto x \cdot \left(1 - \color{blue}{\left(0.6666666666666666 - z\right) \cdot 6}\right) \]
      4. cancel-sign-sub-inv68.1%

        \[\leadsto x \cdot \color{blue}{\left(1 + \left(-\left(0.6666666666666666 - z\right)\right) \cdot 6\right)} \]
      5. distribute-lft-neg-in68.1%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-\left(0.6666666666666666 - z\right) \cdot 6\right)}\right) \]
      6. *-commutative68.1%

        \[\leadsto x \cdot \left(1 + \left(-\color{blue}{6 \cdot \left(0.6666666666666666 - z\right)}\right)\right) \]
      7. sub-neg68.1%

        \[\leadsto x \cdot \left(1 + \left(-6 \cdot \color{blue}{\left(0.6666666666666666 + \left(-z\right)\right)}\right)\right) \]
      8. distribute-lft-in68.2%

        \[\leadsto x \cdot \left(1 + \left(-\color{blue}{\left(6 \cdot 0.6666666666666666 + 6 \cdot \left(-z\right)\right)}\right)\right) \]
      9. metadata-eval68.2%

        \[\leadsto x \cdot \left(1 + \left(-\left(\color{blue}{4} + 6 \cdot \left(-z\right)\right)\right)\right) \]
      10. distribute-rgt-neg-out68.2%

        \[\leadsto x \cdot \left(1 + \left(-\left(4 + \color{blue}{\left(-6 \cdot z\right)}\right)\right)\right) \]
      11. distribute-lft-neg-in68.2%

        \[\leadsto x \cdot \left(1 + \left(-\left(4 + \color{blue}{\left(-6\right) \cdot z}\right)\right)\right) \]
      12. metadata-eval68.2%

        \[\leadsto x \cdot \left(1 + \left(-\left(4 + \color{blue}{-6} \cdot z\right)\right)\right) \]
      13. mul-1-neg68.2%

        \[\leadsto x \cdot \left(1 + \color{blue}{-1 \cdot \left(4 + -6 \cdot z\right)}\right) \]
      14. distribute-lft-in68.2%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-1 \cdot 4 + -1 \cdot \left(-6 \cdot z\right)\right)}\right) \]
      15. metadata-eval68.2%

        \[\leadsto x \cdot \left(1 + \left(\color{blue}{-4} + -1 \cdot \left(-6 \cdot z\right)\right)\right) \]
      16. associate-+r+68.2%

        \[\leadsto x \cdot \color{blue}{\left(\left(1 + -4\right) + -1 \cdot \left(-6 \cdot z\right)\right)} \]
      17. metadata-eval68.2%

        \[\leadsto x \cdot \left(\color{blue}{-3} + -1 \cdot \left(-6 \cdot z\right)\right) \]
      18. associate-*r*68.2%

        \[\leadsto x \cdot \left(-3 + \color{blue}{\left(-1 \cdot -6\right) \cdot z}\right) \]
      19. metadata-eval68.2%

        \[\leadsto x \cdot \left(-3 + \color{blue}{6} \cdot z\right) \]
      20. *-commutative68.2%

        \[\leadsto x \cdot \left(-3 + \color{blue}{z \cdot 6}\right) \]
    7. Simplified68.2%

      \[\leadsto \color{blue}{x \cdot \left(-3 + z \cdot 6\right)} \]
    8. Taylor expanded in z around 0 66.7%

      \[\leadsto \color{blue}{-3 \cdot x} \]
    9. Step-by-step derivation
      1. *-commutative66.7%

        \[\leadsto \color{blue}{x \cdot -3} \]
    10. Simplified66.7%

      \[\leadsto \color{blue}{x \cdot -3} \]

    if -9.2000000000000002e-32 < z < -7.20000000000000064e-151 or -8.99999999999999984e-207 < z < 2.39999999999999991e-275

    1. Initial program 97.5%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Step-by-step derivation
      1. metadata-eval97.5%

        \[\leadsto x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\color{blue}{0.6666666666666666} - z\right) \]
    3. Simplified97.5%

      \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in z around 0 99.9%

      \[\leadsto x + \color{blue}{4 \cdot \left(y - x\right)} \]
    6. Taylor expanded in x around 0 70.9%

      \[\leadsto \color{blue}{4 \cdot y} \]
    7. Step-by-step derivation
      1. *-commutative70.9%

        \[\leadsto \color{blue}{y \cdot 4} \]
    8. Simplified70.9%

      \[\leadsto \color{blue}{y \cdot 4} \]

    if 8e5 < z

    1. Initial program 99.7%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Step-by-step derivation
      1. metadata-eval99.7%

        \[\leadsto x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\color{blue}{0.6666666666666666} - z\right) \]
    3. Simplified99.7%

      \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 51.1%

      \[\leadsto \color{blue}{x \cdot \left(1 + -6 \cdot \left(0.6666666666666666 - z\right)\right)} \]
    6. Step-by-step derivation
      1. metadata-eval51.1%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6\right)} \cdot \left(0.6666666666666666 - z\right)\right) \]
      2. cancel-sign-sub-inv51.1%

        \[\leadsto x \cdot \color{blue}{\left(1 - 6 \cdot \left(0.6666666666666666 - z\right)\right)} \]
      3. *-commutative51.1%

        \[\leadsto x \cdot \left(1 - \color{blue}{\left(0.6666666666666666 - z\right) \cdot 6}\right) \]
      4. cancel-sign-sub-inv51.1%

        \[\leadsto x \cdot \color{blue}{\left(1 + \left(-\left(0.6666666666666666 - z\right)\right) \cdot 6\right)} \]
      5. distribute-lft-neg-in51.1%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-\left(0.6666666666666666 - z\right) \cdot 6\right)}\right) \]
      6. *-commutative51.1%

        \[\leadsto x \cdot \left(1 + \left(-\color{blue}{6 \cdot \left(0.6666666666666666 - z\right)}\right)\right) \]
      7. sub-neg51.1%

        \[\leadsto x \cdot \left(1 + \left(-6 \cdot \color{blue}{\left(0.6666666666666666 + \left(-z\right)\right)}\right)\right) \]
      8. distribute-lft-in51.1%

        \[\leadsto x \cdot \left(1 + \left(-\color{blue}{\left(6 \cdot 0.6666666666666666 + 6 \cdot \left(-z\right)\right)}\right)\right) \]
      9. metadata-eval51.1%

        \[\leadsto x \cdot \left(1 + \left(-\left(\color{blue}{4} + 6 \cdot \left(-z\right)\right)\right)\right) \]
      10. distribute-rgt-neg-out51.1%

        \[\leadsto x \cdot \left(1 + \left(-\left(4 + \color{blue}{\left(-6 \cdot z\right)}\right)\right)\right) \]
      11. distribute-lft-neg-in51.1%

        \[\leadsto x \cdot \left(1 + \left(-\left(4 + \color{blue}{\left(-6\right) \cdot z}\right)\right)\right) \]
      12. metadata-eval51.1%

        \[\leadsto x \cdot \left(1 + \left(-\left(4 + \color{blue}{-6} \cdot z\right)\right)\right) \]
      13. mul-1-neg51.1%

        \[\leadsto x \cdot \left(1 + \color{blue}{-1 \cdot \left(4 + -6 \cdot z\right)}\right) \]
      14. distribute-lft-in51.1%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-1 \cdot 4 + -1 \cdot \left(-6 \cdot z\right)\right)}\right) \]
      15. metadata-eval51.1%

        \[\leadsto x \cdot \left(1 + \left(\color{blue}{-4} + -1 \cdot \left(-6 \cdot z\right)\right)\right) \]
      16. associate-+r+51.1%

        \[\leadsto x \cdot \color{blue}{\left(\left(1 + -4\right) + -1 \cdot \left(-6 \cdot z\right)\right)} \]
      17. metadata-eval51.1%

        \[\leadsto x \cdot \left(\color{blue}{-3} + -1 \cdot \left(-6 \cdot z\right)\right) \]
      18. associate-*r*51.1%

        \[\leadsto x \cdot \left(-3 + \color{blue}{\left(-1 \cdot -6\right) \cdot z}\right) \]
      19. metadata-eval51.1%

        \[\leadsto x \cdot \left(-3 + \color{blue}{6} \cdot z\right) \]
      20. *-commutative51.1%

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

      \[\leadsto \color{blue}{x \cdot \left(-3 + z \cdot 6\right)} \]
    8. Taylor expanded in z around inf 49.8%

      \[\leadsto x \cdot \color{blue}{\left(6 \cdot z\right)} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification58.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.0048:\\ \;\;\;\;z \cdot \left(x \cdot 6\right)\\ \mathbf{elif}\;z \leq -9.2 \cdot 10^{-32}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -7.2 \cdot 10^{-151}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -9 \cdot 10^{-207}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 2.4 \cdot 10^{-275}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 800000:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 49.6% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(z \cdot 6\right)\\ \mathbf{if}\;z \leq -0.0048:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -5.5 \cdot 10^{-31}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -3.6 \cdot 10^{-152}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -5.8 \cdot 10^{-210}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 2.15 \cdot 10^{-275}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 800000:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* x (* z 6.0))))
   (if (<= z -0.0048)
     t_0
     (if (<= z -5.5e-31)
       (* x -3.0)
       (if (<= z -3.6e-152)
         (* y 4.0)
         (if (<= z -5.8e-210)
           (* x -3.0)
           (if (<= z 2.15e-275)
             (* y 4.0)
             (if (<= z 800000.0) (* x -3.0) t_0))))))))
double code(double x, double y, double z) {
	double t_0 = x * (z * 6.0);
	double tmp;
	if (z <= -0.0048) {
		tmp = t_0;
	} else if (z <= -5.5e-31) {
		tmp = x * -3.0;
	} else if (z <= -3.6e-152) {
		tmp = y * 4.0;
	} else if (z <= -5.8e-210) {
		tmp = x * -3.0;
	} else if (z <= 2.15e-275) {
		tmp = y * 4.0;
	} else if (z <= 800000.0) {
		tmp = x * -3.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
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 = x * (z * 6.0d0)
    if (z <= (-0.0048d0)) then
        tmp = t_0
    else if (z <= (-5.5d-31)) then
        tmp = x * (-3.0d0)
    else if (z <= (-3.6d-152)) then
        tmp = y * 4.0d0
    else if (z <= (-5.8d-210)) then
        tmp = x * (-3.0d0)
    else if (z <= 2.15d-275) then
        tmp = y * 4.0d0
    else if (z <= 800000.0d0) then
        tmp = x * (-3.0d0)
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = x * (z * 6.0);
	double tmp;
	if (z <= -0.0048) {
		tmp = t_0;
	} else if (z <= -5.5e-31) {
		tmp = x * -3.0;
	} else if (z <= -3.6e-152) {
		tmp = y * 4.0;
	} else if (z <= -5.8e-210) {
		tmp = x * -3.0;
	} else if (z <= 2.15e-275) {
		tmp = y * 4.0;
	} else if (z <= 800000.0) {
		tmp = x * -3.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x * (z * 6.0)
	tmp = 0
	if z <= -0.0048:
		tmp = t_0
	elif z <= -5.5e-31:
		tmp = x * -3.0
	elif z <= -3.6e-152:
		tmp = y * 4.0
	elif z <= -5.8e-210:
		tmp = x * -3.0
	elif z <= 2.15e-275:
		tmp = y * 4.0
	elif z <= 800000.0:
		tmp = x * -3.0
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(x * Float64(z * 6.0))
	tmp = 0.0
	if (z <= -0.0048)
		tmp = t_0;
	elseif (z <= -5.5e-31)
		tmp = Float64(x * -3.0);
	elseif (z <= -3.6e-152)
		tmp = Float64(y * 4.0);
	elseif (z <= -5.8e-210)
		tmp = Float64(x * -3.0);
	elseif (z <= 2.15e-275)
		tmp = Float64(y * 4.0);
	elseif (z <= 800000.0)
		tmp = Float64(x * -3.0);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x * (z * 6.0);
	tmp = 0.0;
	if (z <= -0.0048)
		tmp = t_0;
	elseif (z <= -5.5e-31)
		tmp = x * -3.0;
	elseif (z <= -3.6e-152)
		tmp = y * 4.0;
	elseif (z <= -5.8e-210)
		tmp = x * -3.0;
	elseif (z <= 2.15e-275)
		tmp = y * 4.0;
	elseif (z <= 800000.0)
		tmp = x * -3.0;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(z * 6.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -0.0048], t$95$0, If[LessEqual[z, -5.5e-31], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, -3.6e-152], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, -5.8e-210], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 2.15e-275], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 800000.0], N[(x * -3.0), $MachinePrecision], t$95$0]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x \cdot \left(z \cdot 6\right)\\
\mathbf{if}\;z \leq -0.0048:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq -5.5 \cdot 10^{-31}:\\
\;\;\;\;x \cdot -3\\

\mathbf{elif}\;z \leq -3.6 \cdot 10^{-152}:\\
\;\;\;\;y \cdot 4\\

\mathbf{elif}\;z \leq -5.8 \cdot 10^{-210}:\\
\;\;\;\;x \cdot -3\\

\mathbf{elif}\;z \leq 2.15 \cdot 10^{-275}:\\
\;\;\;\;y \cdot 4\\

\mathbf{elif}\;z \leq 800000:\\
\;\;\;\;x \cdot -3\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -0.00479999999999999958 or 8e5 < z

    1. Initial program 99.7%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Step-by-step derivation
      1. metadata-eval99.7%

        \[\leadsto x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\color{blue}{0.6666666666666666} - z\right) \]
    3. Simplified99.7%

      \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 51.5%

      \[\leadsto \color{blue}{x \cdot \left(1 + -6 \cdot \left(0.6666666666666666 - z\right)\right)} \]
    6. Step-by-step derivation
      1. metadata-eval51.5%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6\right)} \cdot \left(0.6666666666666666 - z\right)\right) \]
      2. cancel-sign-sub-inv51.5%

        \[\leadsto x \cdot \color{blue}{\left(1 - 6 \cdot \left(0.6666666666666666 - z\right)\right)} \]
      3. *-commutative51.5%

        \[\leadsto x \cdot \left(1 - \color{blue}{\left(0.6666666666666666 - z\right) \cdot 6}\right) \]
      4. cancel-sign-sub-inv51.5%

        \[\leadsto x \cdot \color{blue}{\left(1 + \left(-\left(0.6666666666666666 - z\right)\right) \cdot 6\right)} \]
      5. distribute-lft-neg-in51.5%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-\left(0.6666666666666666 - z\right) \cdot 6\right)}\right) \]
      6. *-commutative51.5%

        \[\leadsto x \cdot \left(1 + \left(-\color{blue}{6 \cdot \left(0.6666666666666666 - z\right)}\right)\right) \]
      7. sub-neg51.5%

        \[\leadsto x \cdot \left(1 + \left(-6 \cdot \color{blue}{\left(0.6666666666666666 + \left(-z\right)\right)}\right)\right) \]
      8. distribute-lft-in51.4%

        \[\leadsto x \cdot \left(1 + \left(-\color{blue}{\left(6 \cdot 0.6666666666666666 + 6 \cdot \left(-z\right)\right)}\right)\right) \]
      9. metadata-eval51.4%

        \[\leadsto x \cdot \left(1 + \left(-\left(\color{blue}{4} + 6 \cdot \left(-z\right)\right)\right)\right) \]
      10. distribute-rgt-neg-out51.4%

        \[\leadsto x \cdot \left(1 + \left(-\left(4 + \color{blue}{\left(-6 \cdot z\right)}\right)\right)\right) \]
      11. distribute-lft-neg-in51.4%

        \[\leadsto x \cdot \left(1 + \left(-\left(4 + \color{blue}{\left(-6\right) \cdot z}\right)\right)\right) \]
      12. metadata-eval51.4%

        \[\leadsto x \cdot \left(1 + \left(-\left(4 + \color{blue}{-6} \cdot z\right)\right)\right) \]
      13. mul-1-neg51.4%

        \[\leadsto x \cdot \left(1 + \color{blue}{-1 \cdot \left(4 + -6 \cdot z\right)}\right) \]
      14. distribute-lft-in51.4%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-1 \cdot 4 + -1 \cdot \left(-6 \cdot z\right)\right)}\right) \]
      15. metadata-eval51.4%

        \[\leadsto x \cdot \left(1 + \left(\color{blue}{-4} + -1 \cdot \left(-6 \cdot z\right)\right)\right) \]
      16. associate-+r+51.4%

        \[\leadsto x \cdot \color{blue}{\left(\left(1 + -4\right) + -1 \cdot \left(-6 \cdot z\right)\right)} \]
      17. metadata-eval51.4%

        \[\leadsto x \cdot \left(\color{blue}{-3} + -1 \cdot \left(-6 \cdot z\right)\right) \]
      18. associate-*r*51.4%

        \[\leadsto x \cdot \left(-3 + \color{blue}{\left(-1 \cdot -6\right) \cdot z}\right) \]
      19. metadata-eval51.4%

        \[\leadsto x \cdot \left(-3 + \color{blue}{6} \cdot z\right) \]
      20. *-commutative51.4%

        \[\leadsto x \cdot \left(-3 + \color{blue}{z \cdot 6}\right) \]
    7. Simplified51.4%

      \[\leadsto \color{blue}{x \cdot \left(-3 + z \cdot 6\right)} \]
    8. Taylor expanded in z around inf 50.0%

      \[\leadsto x \cdot \color{blue}{\left(6 \cdot z\right)} \]

    if -0.00479999999999999958 < z < -5.49999999999999958e-31 or -3.6e-152 < z < -5.80000000000000012e-210 or 2.14999999999999988e-275 < z < 8e5

    1. Initial program 99.2%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Step-by-step derivation
      1. metadata-eval99.2%

        \[\leadsto x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\color{blue}{0.6666666666666666} - z\right) \]
    3. Simplified99.2%

      \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 68.1%

      \[\leadsto \color{blue}{x \cdot \left(1 + -6 \cdot \left(0.6666666666666666 - z\right)\right)} \]
    6. Step-by-step derivation
      1. metadata-eval68.1%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6\right)} \cdot \left(0.6666666666666666 - z\right)\right) \]
      2. cancel-sign-sub-inv68.1%

        \[\leadsto x \cdot \color{blue}{\left(1 - 6 \cdot \left(0.6666666666666666 - z\right)\right)} \]
      3. *-commutative68.1%

        \[\leadsto x \cdot \left(1 - \color{blue}{\left(0.6666666666666666 - z\right) \cdot 6}\right) \]
      4. cancel-sign-sub-inv68.1%

        \[\leadsto x \cdot \color{blue}{\left(1 + \left(-\left(0.6666666666666666 - z\right)\right) \cdot 6\right)} \]
      5. distribute-lft-neg-in68.1%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-\left(0.6666666666666666 - z\right) \cdot 6\right)}\right) \]
      6. *-commutative68.1%

        \[\leadsto x \cdot \left(1 + \left(-\color{blue}{6 \cdot \left(0.6666666666666666 - z\right)}\right)\right) \]
      7. sub-neg68.1%

        \[\leadsto x \cdot \left(1 + \left(-6 \cdot \color{blue}{\left(0.6666666666666666 + \left(-z\right)\right)}\right)\right) \]
      8. distribute-lft-in68.2%

        \[\leadsto x \cdot \left(1 + \left(-\color{blue}{\left(6 \cdot 0.6666666666666666 + 6 \cdot \left(-z\right)\right)}\right)\right) \]
      9. metadata-eval68.2%

        \[\leadsto x \cdot \left(1 + \left(-\left(\color{blue}{4} + 6 \cdot \left(-z\right)\right)\right)\right) \]
      10. distribute-rgt-neg-out68.2%

        \[\leadsto x \cdot \left(1 + \left(-\left(4 + \color{blue}{\left(-6 \cdot z\right)}\right)\right)\right) \]
      11. distribute-lft-neg-in68.2%

        \[\leadsto x \cdot \left(1 + \left(-\left(4 + \color{blue}{\left(-6\right) \cdot z}\right)\right)\right) \]
      12. metadata-eval68.2%

        \[\leadsto x \cdot \left(1 + \left(-\left(4 + \color{blue}{-6} \cdot z\right)\right)\right) \]
      13. mul-1-neg68.2%

        \[\leadsto x \cdot \left(1 + \color{blue}{-1 \cdot \left(4 + -6 \cdot z\right)}\right) \]
      14. distribute-lft-in68.2%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-1 \cdot 4 + -1 \cdot \left(-6 \cdot z\right)\right)}\right) \]
      15. metadata-eval68.2%

        \[\leadsto x \cdot \left(1 + \left(\color{blue}{-4} + -1 \cdot \left(-6 \cdot z\right)\right)\right) \]
      16. associate-+r+68.2%

        \[\leadsto x \cdot \color{blue}{\left(\left(1 + -4\right) + -1 \cdot \left(-6 \cdot z\right)\right)} \]
      17. metadata-eval68.2%

        \[\leadsto x \cdot \left(\color{blue}{-3} + -1 \cdot \left(-6 \cdot z\right)\right) \]
      18. associate-*r*68.2%

        \[\leadsto x \cdot \left(-3 + \color{blue}{\left(-1 \cdot -6\right) \cdot z}\right) \]
      19. metadata-eval68.2%

        \[\leadsto x \cdot \left(-3 + \color{blue}{6} \cdot z\right) \]
      20. *-commutative68.2%

        \[\leadsto x \cdot \left(-3 + \color{blue}{z \cdot 6}\right) \]
    7. Simplified68.2%

      \[\leadsto \color{blue}{x \cdot \left(-3 + z \cdot 6\right)} \]
    8. Taylor expanded in z around 0 66.7%

      \[\leadsto \color{blue}{-3 \cdot x} \]
    9. Step-by-step derivation
      1. *-commutative66.7%

        \[\leadsto \color{blue}{x \cdot -3} \]
    10. Simplified66.7%

      \[\leadsto \color{blue}{x \cdot -3} \]

    if -5.49999999999999958e-31 < z < -3.6e-152 or -5.80000000000000012e-210 < z < 2.14999999999999988e-275

    1. Initial program 97.5%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Step-by-step derivation
      1. metadata-eval97.5%

        \[\leadsto x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\color{blue}{0.6666666666666666} - z\right) \]
    3. Simplified97.5%

      \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in z around 0 99.9%

      \[\leadsto x + \color{blue}{4 \cdot \left(y - x\right)} \]
    6. Taylor expanded in x around 0 70.9%

      \[\leadsto \color{blue}{4 \cdot y} \]
    7. Step-by-step derivation
      1. *-commutative70.9%

        \[\leadsto \color{blue}{y \cdot 4} \]
    8. Simplified70.9%

      \[\leadsto \color{blue}{y \cdot 4} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification58.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.0048:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq -5.5 \cdot 10^{-31}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -3.6 \cdot 10^{-152}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -5.8 \cdot 10^{-210}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 2.15 \cdot 10^{-275}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 800000:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 49.6% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 6 \cdot \left(x \cdot z\right)\\ \mathbf{if}\;z \leq -0.0048:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -3 \cdot 10^{-31}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -5.8 \cdot 10^{-152}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -1.55 \cdot 10^{-208}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.25 \cdot 10^{-275}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 800000:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* 6.0 (* x z))))
   (if (<= z -0.0048)
     t_0
     (if (<= z -3e-31)
       (* x -3.0)
       (if (<= z -5.8e-152)
         (* y 4.0)
         (if (<= z -1.55e-208)
           (* x -3.0)
           (if (<= z 1.25e-275)
             (* y 4.0)
             (if (<= z 800000.0) (* x -3.0) t_0))))))))
double code(double x, double y, double z) {
	double t_0 = 6.0 * (x * z);
	double tmp;
	if (z <= -0.0048) {
		tmp = t_0;
	} else if (z <= -3e-31) {
		tmp = x * -3.0;
	} else if (z <= -5.8e-152) {
		tmp = y * 4.0;
	} else if (z <= -1.55e-208) {
		tmp = x * -3.0;
	} else if (z <= 1.25e-275) {
		tmp = y * 4.0;
	} else if (z <= 800000.0) {
		tmp = x * -3.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
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 = 6.0d0 * (x * z)
    if (z <= (-0.0048d0)) then
        tmp = t_0
    else if (z <= (-3d-31)) then
        tmp = x * (-3.0d0)
    else if (z <= (-5.8d-152)) then
        tmp = y * 4.0d0
    else if (z <= (-1.55d-208)) then
        tmp = x * (-3.0d0)
    else if (z <= 1.25d-275) then
        tmp = y * 4.0d0
    else if (z <= 800000.0d0) then
        tmp = x * (-3.0d0)
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = 6.0 * (x * z);
	double tmp;
	if (z <= -0.0048) {
		tmp = t_0;
	} else if (z <= -3e-31) {
		tmp = x * -3.0;
	} else if (z <= -5.8e-152) {
		tmp = y * 4.0;
	} else if (z <= -1.55e-208) {
		tmp = x * -3.0;
	} else if (z <= 1.25e-275) {
		tmp = y * 4.0;
	} else if (z <= 800000.0) {
		tmp = x * -3.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 6.0 * (x * z)
	tmp = 0
	if z <= -0.0048:
		tmp = t_0
	elif z <= -3e-31:
		tmp = x * -3.0
	elif z <= -5.8e-152:
		tmp = y * 4.0
	elif z <= -1.55e-208:
		tmp = x * -3.0
	elif z <= 1.25e-275:
		tmp = y * 4.0
	elif z <= 800000.0:
		tmp = x * -3.0
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(6.0 * Float64(x * z))
	tmp = 0.0
	if (z <= -0.0048)
		tmp = t_0;
	elseif (z <= -3e-31)
		tmp = Float64(x * -3.0);
	elseif (z <= -5.8e-152)
		tmp = Float64(y * 4.0);
	elseif (z <= -1.55e-208)
		tmp = Float64(x * -3.0);
	elseif (z <= 1.25e-275)
		tmp = Float64(y * 4.0);
	elseif (z <= 800000.0)
		tmp = Float64(x * -3.0);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 6.0 * (x * z);
	tmp = 0.0;
	if (z <= -0.0048)
		tmp = t_0;
	elseif (z <= -3e-31)
		tmp = x * -3.0;
	elseif (z <= -5.8e-152)
		tmp = y * 4.0;
	elseif (z <= -1.55e-208)
		tmp = x * -3.0;
	elseif (z <= 1.25e-275)
		tmp = y * 4.0;
	elseif (z <= 800000.0)
		tmp = x * -3.0;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -0.0048], t$95$0, If[LessEqual[z, -3e-31], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, -5.8e-152], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, -1.55e-208], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 1.25e-275], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 800000.0], N[(x * -3.0), $MachinePrecision], t$95$0]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 6 \cdot \left(x \cdot z\right)\\
\mathbf{if}\;z \leq -0.0048:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq -3 \cdot 10^{-31}:\\
\;\;\;\;x \cdot -3\\

\mathbf{elif}\;z \leq -5.8 \cdot 10^{-152}:\\
\;\;\;\;y \cdot 4\\

\mathbf{elif}\;z \leq -1.55 \cdot 10^{-208}:\\
\;\;\;\;x \cdot -3\\

\mathbf{elif}\;z \leq 1.25 \cdot 10^{-275}:\\
\;\;\;\;y \cdot 4\\

\mathbf{elif}\;z \leq 800000:\\
\;\;\;\;x \cdot -3\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -0.00479999999999999958 or 8e5 < z

    1. Initial program 99.7%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Step-by-step derivation
      1. metadata-eval99.7%

        \[\leadsto x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\color{blue}{0.6666666666666666} - z\right) \]
    3. Simplified99.7%

      \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 51.5%

      \[\leadsto \color{blue}{x \cdot \left(1 + -6 \cdot \left(0.6666666666666666 - z\right)\right)} \]
    6. Step-by-step derivation
      1. metadata-eval51.5%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6\right)} \cdot \left(0.6666666666666666 - z\right)\right) \]
      2. cancel-sign-sub-inv51.5%

        \[\leadsto x \cdot \color{blue}{\left(1 - 6 \cdot \left(0.6666666666666666 - z\right)\right)} \]
      3. *-commutative51.5%

        \[\leadsto x \cdot \left(1 - \color{blue}{\left(0.6666666666666666 - z\right) \cdot 6}\right) \]
      4. cancel-sign-sub-inv51.5%

        \[\leadsto x \cdot \color{blue}{\left(1 + \left(-\left(0.6666666666666666 - z\right)\right) \cdot 6\right)} \]
      5. distribute-lft-neg-in51.5%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-\left(0.6666666666666666 - z\right) \cdot 6\right)}\right) \]
      6. *-commutative51.5%

        \[\leadsto x \cdot \left(1 + \left(-\color{blue}{6 \cdot \left(0.6666666666666666 - z\right)}\right)\right) \]
      7. sub-neg51.5%

        \[\leadsto x \cdot \left(1 + \left(-6 \cdot \color{blue}{\left(0.6666666666666666 + \left(-z\right)\right)}\right)\right) \]
      8. distribute-lft-in51.4%

        \[\leadsto x \cdot \left(1 + \left(-\color{blue}{\left(6 \cdot 0.6666666666666666 + 6 \cdot \left(-z\right)\right)}\right)\right) \]
      9. metadata-eval51.4%

        \[\leadsto x \cdot \left(1 + \left(-\left(\color{blue}{4} + 6 \cdot \left(-z\right)\right)\right)\right) \]
      10. distribute-rgt-neg-out51.4%

        \[\leadsto x \cdot \left(1 + \left(-\left(4 + \color{blue}{\left(-6 \cdot z\right)}\right)\right)\right) \]
      11. distribute-lft-neg-in51.4%

        \[\leadsto x \cdot \left(1 + \left(-\left(4 + \color{blue}{\left(-6\right) \cdot z}\right)\right)\right) \]
      12. metadata-eval51.4%

        \[\leadsto x \cdot \left(1 + \left(-\left(4 + \color{blue}{-6} \cdot z\right)\right)\right) \]
      13. mul-1-neg51.4%

        \[\leadsto x \cdot \left(1 + \color{blue}{-1 \cdot \left(4 + -6 \cdot z\right)}\right) \]
      14. distribute-lft-in51.4%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-1 \cdot 4 + -1 \cdot \left(-6 \cdot z\right)\right)}\right) \]
      15. metadata-eval51.4%

        \[\leadsto x \cdot \left(1 + \left(\color{blue}{-4} + -1 \cdot \left(-6 \cdot z\right)\right)\right) \]
      16. associate-+r+51.4%

        \[\leadsto x \cdot \color{blue}{\left(\left(1 + -4\right) + -1 \cdot \left(-6 \cdot z\right)\right)} \]
      17. metadata-eval51.4%

        \[\leadsto x \cdot \left(\color{blue}{-3} + -1 \cdot \left(-6 \cdot z\right)\right) \]
      18. associate-*r*51.4%

        \[\leadsto x \cdot \left(-3 + \color{blue}{\left(-1 \cdot -6\right) \cdot z}\right) \]
      19. metadata-eval51.4%

        \[\leadsto x \cdot \left(-3 + \color{blue}{6} \cdot z\right) \]
      20. *-commutative51.4%

        \[\leadsto x \cdot \left(-3 + \color{blue}{z \cdot 6}\right) \]
    7. Simplified51.4%

      \[\leadsto \color{blue}{x \cdot \left(-3 + z \cdot 6\right)} \]
    8. Taylor expanded in z around 0 51.4%

      \[\leadsto \color{blue}{-3 \cdot x + 6 \cdot \left(x \cdot z\right)} \]
    9. Taylor expanded in z around inf 49.9%

      \[\leadsto \color{blue}{6 \cdot \left(x \cdot z\right)} \]

    if -0.00479999999999999958 < z < -2.99999999999999981e-31 or -5.8000000000000003e-152 < z < -1.5499999999999999e-208 or 1.24999999999999996e-275 < z < 8e5

    1. Initial program 99.2%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Step-by-step derivation
      1. metadata-eval99.2%

        \[\leadsto x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\color{blue}{0.6666666666666666} - z\right) \]
    3. Simplified99.2%

      \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 68.1%

      \[\leadsto \color{blue}{x \cdot \left(1 + -6 \cdot \left(0.6666666666666666 - z\right)\right)} \]
    6. Step-by-step derivation
      1. metadata-eval68.1%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6\right)} \cdot \left(0.6666666666666666 - z\right)\right) \]
      2. cancel-sign-sub-inv68.1%

        \[\leadsto x \cdot \color{blue}{\left(1 - 6 \cdot \left(0.6666666666666666 - z\right)\right)} \]
      3. *-commutative68.1%

        \[\leadsto x \cdot \left(1 - \color{blue}{\left(0.6666666666666666 - z\right) \cdot 6}\right) \]
      4. cancel-sign-sub-inv68.1%

        \[\leadsto x \cdot \color{blue}{\left(1 + \left(-\left(0.6666666666666666 - z\right)\right) \cdot 6\right)} \]
      5. distribute-lft-neg-in68.1%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-\left(0.6666666666666666 - z\right) \cdot 6\right)}\right) \]
      6. *-commutative68.1%

        \[\leadsto x \cdot \left(1 + \left(-\color{blue}{6 \cdot \left(0.6666666666666666 - z\right)}\right)\right) \]
      7. sub-neg68.1%

        \[\leadsto x \cdot \left(1 + \left(-6 \cdot \color{blue}{\left(0.6666666666666666 + \left(-z\right)\right)}\right)\right) \]
      8. distribute-lft-in68.2%

        \[\leadsto x \cdot \left(1 + \left(-\color{blue}{\left(6 \cdot 0.6666666666666666 + 6 \cdot \left(-z\right)\right)}\right)\right) \]
      9. metadata-eval68.2%

        \[\leadsto x \cdot \left(1 + \left(-\left(\color{blue}{4} + 6 \cdot \left(-z\right)\right)\right)\right) \]
      10. distribute-rgt-neg-out68.2%

        \[\leadsto x \cdot \left(1 + \left(-\left(4 + \color{blue}{\left(-6 \cdot z\right)}\right)\right)\right) \]
      11. distribute-lft-neg-in68.2%

        \[\leadsto x \cdot \left(1 + \left(-\left(4 + \color{blue}{\left(-6\right) \cdot z}\right)\right)\right) \]
      12. metadata-eval68.2%

        \[\leadsto x \cdot \left(1 + \left(-\left(4 + \color{blue}{-6} \cdot z\right)\right)\right) \]
      13. mul-1-neg68.2%

        \[\leadsto x \cdot \left(1 + \color{blue}{-1 \cdot \left(4 + -6 \cdot z\right)}\right) \]
      14. distribute-lft-in68.2%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-1 \cdot 4 + -1 \cdot \left(-6 \cdot z\right)\right)}\right) \]
      15. metadata-eval68.2%

        \[\leadsto x \cdot \left(1 + \left(\color{blue}{-4} + -1 \cdot \left(-6 \cdot z\right)\right)\right) \]
      16. associate-+r+68.2%

        \[\leadsto x \cdot \color{blue}{\left(\left(1 + -4\right) + -1 \cdot \left(-6 \cdot z\right)\right)} \]
      17. metadata-eval68.2%

        \[\leadsto x \cdot \left(\color{blue}{-3} + -1 \cdot \left(-6 \cdot z\right)\right) \]
      18. associate-*r*68.2%

        \[\leadsto x \cdot \left(-3 + \color{blue}{\left(-1 \cdot -6\right) \cdot z}\right) \]
      19. metadata-eval68.2%

        \[\leadsto x \cdot \left(-3 + \color{blue}{6} \cdot z\right) \]
      20. *-commutative68.2%

        \[\leadsto x \cdot \left(-3 + \color{blue}{z \cdot 6}\right) \]
    7. Simplified68.2%

      \[\leadsto \color{blue}{x \cdot \left(-3 + z \cdot 6\right)} \]
    8. Taylor expanded in z around 0 66.7%

      \[\leadsto \color{blue}{-3 \cdot x} \]
    9. Step-by-step derivation
      1. *-commutative66.7%

        \[\leadsto \color{blue}{x \cdot -3} \]
    10. Simplified66.7%

      \[\leadsto \color{blue}{x \cdot -3} \]

    if -2.99999999999999981e-31 < z < -5.8000000000000003e-152 or -1.5499999999999999e-208 < z < 1.24999999999999996e-275

    1. Initial program 97.5%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Step-by-step derivation
      1. metadata-eval97.5%

        \[\leadsto x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\color{blue}{0.6666666666666666} - z\right) \]
    3. Simplified97.5%

      \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in z around 0 99.9%

      \[\leadsto x + \color{blue}{4 \cdot \left(y - x\right)} \]
    6. Taylor expanded in x around 0 70.9%

      \[\leadsto \color{blue}{4 \cdot y} \]
    7. Step-by-step derivation
      1. *-commutative70.9%

        \[\leadsto \color{blue}{y \cdot 4} \]
    8. Simplified70.9%

      \[\leadsto \color{blue}{y \cdot 4} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 5: 58.4% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\ \mathbf{if}\;y \leq -2.9 \cdot 10^{-18}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 4.4 \cdot 10^{-282}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;y \leq 3.3 \cdot 10^{-41}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* 6.0 (* y (- 0.6666666666666666 z)))))
   (if (<= y -2.9e-18)
     t_0
     (if (<= y 4.4e-282) (* x -3.0) (if (<= y 3.3e-41) (* 6.0 (* x z)) t_0)))))
double code(double x, double y, double z) {
	double t_0 = 6.0 * (y * (0.6666666666666666 - z));
	double tmp;
	if (y <= -2.9e-18) {
		tmp = t_0;
	} else if (y <= 4.4e-282) {
		tmp = x * -3.0;
	} else if (y <= 3.3e-41) {
		tmp = 6.0 * (x * z);
	} else {
		tmp = t_0;
	}
	return tmp;
}
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 = 6.0d0 * (y * (0.6666666666666666d0 - z))
    if (y <= (-2.9d-18)) then
        tmp = t_0
    else if (y <= 4.4d-282) then
        tmp = x * (-3.0d0)
    else if (y <= 3.3d-41) then
        tmp = 6.0d0 * (x * z)
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = 6.0 * (y * (0.6666666666666666 - z));
	double tmp;
	if (y <= -2.9e-18) {
		tmp = t_0;
	} else if (y <= 4.4e-282) {
		tmp = x * -3.0;
	} else if (y <= 3.3e-41) {
		tmp = 6.0 * (x * z);
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 6.0 * (y * (0.6666666666666666 - z))
	tmp = 0
	if y <= -2.9e-18:
		tmp = t_0
	elif y <= 4.4e-282:
		tmp = x * -3.0
	elif y <= 3.3e-41:
		tmp = 6.0 * (x * z)
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(6.0 * Float64(y * Float64(0.6666666666666666 - z)))
	tmp = 0.0
	if (y <= -2.9e-18)
		tmp = t_0;
	elseif (y <= 4.4e-282)
		tmp = Float64(x * -3.0);
	elseif (y <= 3.3e-41)
		tmp = Float64(6.0 * Float64(x * z));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 6.0 * (y * (0.6666666666666666 - z));
	tmp = 0.0;
	if (y <= -2.9e-18)
		tmp = t_0;
	elseif (y <= 4.4e-282)
		tmp = x * -3.0;
	elseif (y <= 3.3e-41)
		tmp = 6.0 * (x * z);
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(6.0 * N[(y * N[(0.6666666666666666 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.9e-18], t$95$0, If[LessEqual[y, 4.4e-282], N[(x * -3.0), $MachinePrecision], If[LessEqual[y, 3.3e-41], N[(6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\
\mathbf{if}\;y \leq -2.9 \cdot 10^{-18}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y \leq 4.4 \cdot 10^{-282}:\\
\;\;\;\;x \cdot -3\\

\mathbf{elif}\;y \leq 3.3 \cdot 10^{-41}:\\
\;\;\;\;6 \cdot \left(x \cdot z\right)\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -2.9e-18 or 3.30000000000000024e-41 < y

    1. Initial program 99.0%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Step-by-step derivation
      1. metadata-eval99.0%

        \[\leadsto x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\color{blue}{0.6666666666666666} - z\right) \]
    3. Simplified99.0%

      \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 99.0%

      \[\leadsto \color{blue}{y \cdot \left(-6 \cdot \frac{x \cdot \left(0.6666666666666666 - z\right)}{y} + \left(6 \cdot \left(0.6666666666666666 - z\right) + \frac{x}{y}\right)\right)} \]
    6. Taylor expanded in y around inf 76.5%

      \[\leadsto \color{blue}{6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)} \]
    7. Step-by-step derivation
      1. *-commutative76.5%

        \[\leadsto 6 \cdot \color{blue}{\left(\left(0.6666666666666666 - z\right) \cdot y\right)} \]
    8. Simplified76.5%

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

    if -2.9e-18 < y < 4.39999999999999962e-282

    1. Initial program 99.3%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Step-by-step derivation
      1. metadata-eval99.3%

        \[\leadsto x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\color{blue}{0.6666666666666666} - z\right) \]
    3. Simplified99.3%

      \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 90.8%

      \[\leadsto \color{blue}{x \cdot \left(1 + -6 \cdot \left(0.6666666666666666 - z\right)\right)} \]
    6. Step-by-step derivation
      1. metadata-eval90.8%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6\right)} \cdot \left(0.6666666666666666 - z\right)\right) \]
      2. cancel-sign-sub-inv90.8%

        \[\leadsto x \cdot \color{blue}{\left(1 - 6 \cdot \left(0.6666666666666666 - z\right)\right)} \]
      3. *-commutative90.8%

        \[\leadsto x \cdot \left(1 - \color{blue}{\left(0.6666666666666666 - z\right) \cdot 6}\right) \]
      4. cancel-sign-sub-inv90.8%

        \[\leadsto x \cdot \color{blue}{\left(1 + \left(-\left(0.6666666666666666 - z\right)\right) \cdot 6\right)} \]
      5. distribute-lft-neg-in90.8%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-\left(0.6666666666666666 - z\right) \cdot 6\right)}\right) \]
      6. *-commutative90.8%

        \[\leadsto x \cdot \left(1 + \left(-\color{blue}{6 \cdot \left(0.6666666666666666 - z\right)}\right)\right) \]
      7. sub-neg90.8%

        \[\leadsto x \cdot \left(1 + \left(-6 \cdot \color{blue}{\left(0.6666666666666666 + \left(-z\right)\right)}\right)\right) \]
      8. distribute-lft-in90.8%

        \[\leadsto x \cdot \left(1 + \left(-\color{blue}{\left(6 \cdot 0.6666666666666666 + 6 \cdot \left(-z\right)\right)}\right)\right) \]
      9. metadata-eval90.8%

        \[\leadsto x \cdot \left(1 + \left(-\left(\color{blue}{4} + 6 \cdot \left(-z\right)\right)\right)\right) \]
      10. distribute-rgt-neg-out90.8%

        \[\leadsto x \cdot \left(1 + \left(-\left(4 + \color{blue}{\left(-6 \cdot z\right)}\right)\right)\right) \]
      11. distribute-lft-neg-in90.8%

        \[\leadsto x \cdot \left(1 + \left(-\left(4 + \color{blue}{\left(-6\right) \cdot z}\right)\right)\right) \]
      12. metadata-eval90.8%

        \[\leadsto x \cdot \left(1 + \left(-\left(4 + \color{blue}{-6} \cdot z\right)\right)\right) \]
      13. mul-1-neg90.8%

        \[\leadsto x \cdot \left(1 + \color{blue}{-1 \cdot \left(4 + -6 \cdot z\right)}\right) \]
      14. distribute-lft-in90.8%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-1 \cdot 4 + -1 \cdot \left(-6 \cdot z\right)\right)}\right) \]
      15. metadata-eval90.8%

        \[\leadsto x \cdot \left(1 + \left(\color{blue}{-4} + -1 \cdot \left(-6 \cdot z\right)\right)\right) \]
      16. associate-+r+90.9%

        \[\leadsto x \cdot \color{blue}{\left(\left(1 + -4\right) + -1 \cdot \left(-6 \cdot z\right)\right)} \]
      17. metadata-eval90.9%

        \[\leadsto x \cdot \left(\color{blue}{-3} + -1 \cdot \left(-6 \cdot z\right)\right) \]
      18. associate-*r*90.9%

        \[\leadsto x \cdot \left(-3 + \color{blue}{\left(-1 \cdot -6\right) \cdot z}\right) \]
      19. metadata-eval90.9%

        \[\leadsto x \cdot \left(-3 + \color{blue}{6} \cdot z\right) \]
      20. *-commutative90.9%

        \[\leadsto x \cdot \left(-3 + \color{blue}{z \cdot 6}\right) \]
    7. Simplified90.9%

      \[\leadsto \color{blue}{x \cdot \left(-3 + z \cdot 6\right)} \]
    8. Taylor expanded in z around 0 55.5%

      \[\leadsto \color{blue}{-3 \cdot x} \]
    9. Step-by-step derivation
      1. *-commutative55.5%

        \[\leadsto \color{blue}{x \cdot -3} \]
    10. Simplified55.5%

      \[\leadsto \color{blue}{x \cdot -3} \]

    if 4.39999999999999962e-282 < y < 3.30000000000000024e-41

    1. Initial program 99.5%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Step-by-step derivation
      1. metadata-eval99.5%

        \[\leadsto x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\color{blue}{0.6666666666666666} - z\right) \]
    3. Simplified99.5%

      \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 79.5%

      \[\leadsto \color{blue}{x \cdot \left(1 + -6 \cdot \left(0.6666666666666666 - z\right)\right)} \]
    6. Step-by-step derivation
      1. metadata-eval79.5%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6\right)} \cdot \left(0.6666666666666666 - z\right)\right) \]
      2. cancel-sign-sub-inv79.5%

        \[\leadsto x \cdot \color{blue}{\left(1 - 6 \cdot \left(0.6666666666666666 - z\right)\right)} \]
      3. *-commutative79.5%

        \[\leadsto x \cdot \left(1 - \color{blue}{\left(0.6666666666666666 - z\right) \cdot 6}\right) \]
      4. cancel-sign-sub-inv79.5%

        \[\leadsto x \cdot \color{blue}{\left(1 + \left(-\left(0.6666666666666666 - z\right)\right) \cdot 6\right)} \]
      5. distribute-lft-neg-in79.5%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-\left(0.6666666666666666 - z\right) \cdot 6\right)}\right) \]
      6. *-commutative79.5%

        \[\leadsto x \cdot \left(1 + \left(-\color{blue}{6 \cdot \left(0.6666666666666666 - z\right)}\right)\right) \]
      7. sub-neg79.5%

        \[\leadsto x \cdot \left(1 + \left(-6 \cdot \color{blue}{\left(0.6666666666666666 + \left(-z\right)\right)}\right)\right) \]
      8. distribute-lft-in79.5%

        \[\leadsto x \cdot \left(1 + \left(-\color{blue}{\left(6 \cdot 0.6666666666666666 + 6 \cdot \left(-z\right)\right)}\right)\right) \]
      9. metadata-eval79.5%

        \[\leadsto x \cdot \left(1 + \left(-\left(\color{blue}{4} + 6 \cdot \left(-z\right)\right)\right)\right) \]
      10. distribute-rgt-neg-out79.5%

        \[\leadsto x \cdot \left(1 + \left(-\left(4 + \color{blue}{\left(-6 \cdot z\right)}\right)\right)\right) \]
      11. distribute-lft-neg-in79.5%

        \[\leadsto x \cdot \left(1 + \left(-\left(4 + \color{blue}{\left(-6\right) \cdot z}\right)\right)\right) \]
      12. metadata-eval79.5%

        \[\leadsto x \cdot \left(1 + \left(-\left(4 + \color{blue}{-6} \cdot z\right)\right)\right) \]
      13. mul-1-neg79.5%

        \[\leadsto x \cdot \left(1 + \color{blue}{-1 \cdot \left(4 + -6 \cdot z\right)}\right) \]
      14. distribute-lft-in79.5%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-1 \cdot 4 + -1 \cdot \left(-6 \cdot z\right)\right)}\right) \]
      15. metadata-eval79.5%

        \[\leadsto x \cdot \left(1 + \left(\color{blue}{-4} + -1 \cdot \left(-6 \cdot z\right)\right)\right) \]
      16. associate-+r+79.5%

        \[\leadsto x \cdot \color{blue}{\left(\left(1 + -4\right) + -1 \cdot \left(-6 \cdot z\right)\right)} \]
      17. metadata-eval79.5%

        \[\leadsto x \cdot \left(\color{blue}{-3} + -1 \cdot \left(-6 \cdot z\right)\right) \]
      18. associate-*r*79.5%

        \[\leadsto x \cdot \left(-3 + \color{blue}{\left(-1 \cdot -6\right) \cdot z}\right) \]
      19. metadata-eval79.5%

        \[\leadsto x \cdot \left(-3 + \color{blue}{6} \cdot z\right) \]
      20. *-commutative79.5%

        \[\leadsto x \cdot \left(-3 + \color{blue}{z \cdot 6}\right) \]
    7. Simplified79.5%

      \[\leadsto \color{blue}{x \cdot \left(-3 + z \cdot 6\right)} \]
    8. Taylor expanded in z around 0 79.6%

      \[\leadsto \color{blue}{-3 \cdot x + 6 \cdot \left(x \cdot z\right)} \]
    9. Taylor expanded in z around inf 45.9%

      \[\leadsto \color{blue}{6 \cdot \left(x \cdot z\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification65.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.9 \cdot 10^{-18}:\\ \;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\ \mathbf{elif}\;y \leq 4.4 \cdot 10^{-282}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;y \leq 3.3 \cdot 10^{-41}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 97.5% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -0.66 \lor \neg \left(z \leq 0.65\right):\\ \;\;\;\;x + -6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x + \left(y - x\right) \cdot 4\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= z -0.66) (not (<= z 0.65)))
   (+ x (* -6.0 (* (- y x) z)))
   (+ x (* (- y x) 4.0))))
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -0.66) || !(z <= 0.65)) {
		tmp = x + (-6.0 * ((y - x) * z));
	} else {
		tmp = x + ((y - x) * 4.0);
	}
	return tmp;
}
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 ((z <= (-0.66d0)) .or. (.not. (z <= 0.65d0))) then
        tmp = x + ((-6.0d0) * ((y - x) * z))
    else
        tmp = x + ((y - x) * 4.0d0)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((z <= -0.66) || !(z <= 0.65)) {
		tmp = x + (-6.0 * ((y - x) * z));
	} else {
		tmp = x + ((y - x) * 4.0);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (z <= -0.66) or not (z <= 0.65):
		tmp = x + (-6.0 * ((y - x) * z))
	else:
		tmp = x + ((y - x) * 4.0)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((z <= -0.66) || !(z <= 0.65))
		tmp = Float64(x + Float64(-6.0 * Float64(Float64(y - x) * z)));
	else
		tmp = Float64(x + Float64(Float64(y - x) * 4.0));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((z <= -0.66) || ~((z <= 0.65)))
		tmp = x + (-6.0 * ((y - x) * z));
	else
		tmp = x + ((y - x) * 4.0);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.66], N[Not[LessEqual[z, 0.65]], $MachinePrecision]], N[(x + N[(-6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y - x), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.66 \lor \neg \left(z \leq 0.65\right):\\
\;\;\;\;x + -6 \cdot \left(\left(y - x\right) \cdot z\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -0.660000000000000031 or 0.650000000000000022 < z

    1. Initial program 99.7%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Step-by-step derivation
      1. metadata-eval99.7%

        \[\leadsto x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\color{blue}{0.6666666666666666} - z\right) \]
    3. Simplified99.7%

      \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 96.6%

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

    if -0.660000000000000031 < z < 0.650000000000000022

    1. Initial program 98.6%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Step-by-step derivation
      1. metadata-eval98.6%

        \[\leadsto x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\color{blue}{0.6666666666666666} - z\right) \]
    3. Simplified98.6%

      \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in z around 0 97.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.66 \lor \neg \left(z \leq 0.65\right):\\ \;\;\;\;x + -6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x + \left(y - x\right) \cdot 4\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 75.3% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -5.5 \cdot 10^{+28} \lor \neg \left(y \leq 4.9 \cdot 10^{-40}\right):\\ \;\;\;\;y \cdot \left(4 + z \cdot -6\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= y -5.5e+28) (not (<= y 4.9e-40)))
   (* y (+ 4.0 (* z -6.0)))
   (* x (+ -3.0 (* z 6.0)))))
double code(double x, double y, double z) {
	double tmp;
	if ((y <= -5.5e+28) || !(y <= 4.9e-40)) {
		tmp = y * (4.0 + (z * -6.0));
	} else {
		tmp = x * (-3.0 + (z * 6.0));
	}
	return tmp;
}
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 <= (-5.5d+28)) .or. (.not. (y <= 4.9d-40))) then
        tmp = y * (4.0d0 + (z * (-6.0d0)))
    else
        tmp = x * ((-3.0d0) + (z * 6.0d0))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((y <= -5.5e+28) || !(y <= 4.9e-40)) {
		tmp = y * (4.0 + (z * -6.0));
	} else {
		tmp = x * (-3.0 + (z * 6.0));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (y <= -5.5e+28) or not (y <= 4.9e-40):
		tmp = y * (4.0 + (z * -6.0))
	else:
		tmp = x * (-3.0 + (z * 6.0))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((y <= -5.5e+28) || !(y <= 4.9e-40))
		tmp = Float64(y * Float64(4.0 + Float64(z * -6.0)));
	else
		tmp = Float64(x * Float64(-3.0 + Float64(z * 6.0)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((y <= -5.5e+28) || ~((y <= 4.9e-40)))
		tmp = y * (4.0 + (z * -6.0));
	else
		tmp = x * (-3.0 + (z * 6.0));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[y, -5.5e+28], N[Not[LessEqual[y, 4.9e-40]], $MachinePrecision]], N[(y * N[(4.0 + N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(-3.0 + N[(z * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.5 \cdot 10^{+28} \lor \neg \left(y \leq 4.9 \cdot 10^{-40}\right):\\
\;\;\;\;y \cdot \left(4 + z \cdot -6\right)\\

\mathbf{else}:\\
\;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -5.5000000000000003e28 or 4.8999999999999997e-40 < y

    1. Initial program 99.0%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Step-by-step derivation
      1. +-commutative99.0%

        \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) + x} \]
      2. associate-*l*99.9%

        \[\leadsto \color{blue}{\left(y - x\right) \cdot \left(6 \cdot \left(\frac{2}{3} - z\right)\right)} + x \]
      3. fma-define99.8%

        \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, 6 \cdot \left(\frac{2}{3} - z\right), x\right)} \]
      4. sub-neg99.8%

        \[\leadsto \mathsf{fma}\left(y - x, 6 \cdot \color{blue}{\left(\frac{2}{3} + \left(-z\right)\right)}, x\right) \]
      5. distribute-rgt-in99.9%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\frac{2}{3} \cdot 6 + \left(-z\right) \cdot 6}, x\right) \]
      6. metadata-eval99.9%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{0.6666666666666666} \cdot 6 + \left(-z\right) \cdot 6, x\right) \]
      7. metadata-eval99.9%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{4} + \left(-z\right) \cdot 6, x\right) \]
      8. distribute-lft-neg-out99.9%

        \[\leadsto \mathsf{fma}\left(y - x, 4 + \color{blue}{\left(-z \cdot 6\right)}, x\right) \]
      9. distribute-rgt-neg-in99.9%

        \[\leadsto \mathsf{fma}\left(y - x, 4 + \color{blue}{z \cdot \left(-6\right)}, x\right) \]
      10. metadata-eval99.9%

        \[\leadsto \mathsf{fma}\left(y - x, 4 + z \cdot \color{blue}{-6}, x\right) \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, 4 + z \cdot -6, x\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 79.4%

      \[\leadsto \color{blue}{y \cdot \left(4 + -6 \cdot z\right)} \]

    if -5.5000000000000003e28 < y < 4.8999999999999997e-40

    1. Initial program 99.4%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Step-by-step derivation
      1. metadata-eval99.4%

        \[\leadsto x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\color{blue}{0.6666666666666666} - z\right) \]
    3. Simplified99.4%

      \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 84.5%

      \[\leadsto \color{blue}{x \cdot \left(1 + -6 \cdot \left(0.6666666666666666 - z\right)\right)} \]
    6. Step-by-step derivation
      1. metadata-eval84.5%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6\right)} \cdot \left(0.6666666666666666 - z\right)\right) \]
      2. cancel-sign-sub-inv84.5%

        \[\leadsto x \cdot \color{blue}{\left(1 - 6 \cdot \left(0.6666666666666666 - z\right)\right)} \]
      3. *-commutative84.5%

        \[\leadsto x \cdot \left(1 - \color{blue}{\left(0.6666666666666666 - z\right) \cdot 6}\right) \]
      4. cancel-sign-sub-inv84.5%

        \[\leadsto x \cdot \color{blue}{\left(1 + \left(-\left(0.6666666666666666 - z\right)\right) \cdot 6\right)} \]
      5. distribute-lft-neg-in84.5%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-\left(0.6666666666666666 - z\right) \cdot 6\right)}\right) \]
      6. *-commutative84.5%

        \[\leadsto x \cdot \left(1 + \left(-\color{blue}{6 \cdot \left(0.6666666666666666 - z\right)}\right)\right) \]
      7. sub-neg84.5%

        \[\leadsto x \cdot \left(1 + \left(-6 \cdot \color{blue}{\left(0.6666666666666666 + \left(-z\right)\right)}\right)\right) \]
      8. distribute-lft-in84.5%

        \[\leadsto x \cdot \left(1 + \left(-\color{blue}{\left(6 \cdot 0.6666666666666666 + 6 \cdot \left(-z\right)\right)}\right)\right) \]
      9. metadata-eval84.5%

        \[\leadsto x \cdot \left(1 + \left(-\left(\color{blue}{4} + 6 \cdot \left(-z\right)\right)\right)\right) \]
      10. distribute-rgt-neg-out84.5%

        \[\leadsto x \cdot \left(1 + \left(-\left(4 + \color{blue}{\left(-6 \cdot z\right)}\right)\right)\right) \]
      11. distribute-lft-neg-in84.5%

        \[\leadsto x \cdot \left(1 + \left(-\left(4 + \color{blue}{\left(-6\right) \cdot z}\right)\right)\right) \]
      12. metadata-eval84.5%

        \[\leadsto x \cdot \left(1 + \left(-\left(4 + \color{blue}{-6} \cdot z\right)\right)\right) \]
      13. mul-1-neg84.5%

        \[\leadsto x \cdot \left(1 + \color{blue}{-1 \cdot \left(4 + -6 \cdot z\right)}\right) \]
      14. distribute-lft-in84.5%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-1 \cdot 4 + -1 \cdot \left(-6 \cdot z\right)\right)}\right) \]
      15. metadata-eval84.5%

        \[\leadsto x \cdot \left(1 + \left(\color{blue}{-4} + -1 \cdot \left(-6 \cdot z\right)\right)\right) \]
      16. associate-+r+84.5%

        \[\leadsto x \cdot \color{blue}{\left(\left(1 + -4\right) + -1 \cdot \left(-6 \cdot z\right)\right)} \]
      17. metadata-eval84.5%

        \[\leadsto x \cdot \left(\color{blue}{-3} + -1 \cdot \left(-6 \cdot z\right)\right) \]
      18. associate-*r*84.5%

        \[\leadsto x \cdot \left(-3 + \color{blue}{\left(-1 \cdot -6\right) \cdot z}\right) \]
      19. metadata-eval84.5%

        \[\leadsto x \cdot \left(-3 + \color{blue}{6} \cdot z\right) \]
      20. *-commutative84.5%

        \[\leadsto x \cdot \left(-3 + \color{blue}{z \cdot 6}\right) \]
    7. Simplified84.5%

      \[\leadsto \color{blue}{x \cdot \left(-3 + z \cdot 6\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification81.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5.5 \cdot 10^{+28} \lor \neg \left(y \leq 4.9 \cdot 10^{-40}\right):\\ \;\;\;\;y \cdot \left(4 + z \cdot -6\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 75.3% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -2.6 \cdot 10^{+28} \lor \neg \left(y \leq 1.06 \cdot 10^{-36}\right):\\ \;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= y -2.6e+28) (not (<= y 1.06e-36)))
   (* 6.0 (* y (- 0.6666666666666666 z)))
   (* x (+ -3.0 (* z 6.0)))))
double code(double x, double y, double z) {
	double tmp;
	if ((y <= -2.6e+28) || !(y <= 1.06e-36)) {
		tmp = 6.0 * (y * (0.6666666666666666 - z));
	} else {
		tmp = x * (-3.0 + (z * 6.0));
	}
	return tmp;
}
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 <= (-2.6d+28)) .or. (.not. (y <= 1.06d-36))) then
        tmp = 6.0d0 * (y * (0.6666666666666666d0 - z))
    else
        tmp = x * ((-3.0d0) + (z * 6.0d0))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((y <= -2.6e+28) || !(y <= 1.06e-36)) {
		tmp = 6.0 * (y * (0.6666666666666666 - z));
	} else {
		tmp = x * (-3.0 + (z * 6.0));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (y <= -2.6e+28) or not (y <= 1.06e-36):
		tmp = 6.0 * (y * (0.6666666666666666 - z))
	else:
		tmp = x * (-3.0 + (z * 6.0))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((y <= -2.6e+28) || !(y <= 1.06e-36))
		tmp = Float64(6.0 * Float64(y * Float64(0.6666666666666666 - z)));
	else
		tmp = Float64(x * Float64(-3.0 + Float64(z * 6.0)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((y <= -2.6e+28) || ~((y <= 1.06e-36)))
		tmp = 6.0 * (y * (0.6666666666666666 - z));
	else
		tmp = x * (-3.0 + (z * 6.0));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.6e+28], N[Not[LessEqual[y, 1.06e-36]], $MachinePrecision]], N[(6.0 * N[(y * N[(0.6666666666666666 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(-3.0 + N[(z * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.6 \cdot 10^{+28} \lor \neg \left(y \leq 1.06 \cdot 10^{-36}\right):\\
\;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\

\mathbf{else}:\\
\;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.6000000000000002e28 or 1.05999999999999999e-36 < y

    1. Initial program 99.0%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Step-by-step derivation
      1. metadata-eval99.0%

        \[\leadsto x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\color{blue}{0.6666666666666666} - z\right) \]
    3. Simplified99.0%

      \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 99.0%

      \[\leadsto \color{blue}{y \cdot \left(-6 \cdot \frac{x \cdot \left(0.6666666666666666 - z\right)}{y} + \left(6 \cdot \left(0.6666666666666666 - z\right) + \frac{x}{y}\right)\right)} \]
    6. Taylor expanded in y around inf 79.2%

      \[\leadsto \color{blue}{6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)} \]
    7. Step-by-step derivation
      1. *-commutative79.2%

        \[\leadsto 6 \cdot \color{blue}{\left(\left(0.6666666666666666 - z\right) \cdot y\right)} \]
    8. Simplified79.2%

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

    if -2.6000000000000002e28 < y < 1.05999999999999999e-36

    1. Initial program 99.4%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Step-by-step derivation
      1. metadata-eval99.4%

        \[\leadsto x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\color{blue}{0.6666666666666666} - z\right) \]
    3. Simplified99.4%

      \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 84.5%

      \[\leadsto \color{blue}{x \cdot \left(1 + -6 \cdot \left(0.6666666666666666 - z\right)\right)} \]
    6. Step-by-step derivation
      1. metadata-eval84.5%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6\right)} \cdot \left(0.6666666666666666 - z\right)\right) \]
      2. cancel-sign-sub-inv84.5%

        \[\leadsto x \cdot \color{blue}{\left(1 - 6 \cdot \left(0.6666666666666666 - z\right)\right)} \]
      3. *-commutative84.5%

        \[\leadsto x \cdot \left(1 - \color{blue}{\left(0.6666666666666666 - z\right) \cdot 6}\right) \]
      4. cancel-sign-sub-inv84.5%

        \[\leadsto x \cdot \color{blue}{\left(1 + \left(-\left(0.6666666666666666 - z\right)\right) \cdot 6\right)} \]
      5. distribute-lft-neg-in84.5%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-\left(0.6666666666666666 - z\right) \cdot 6\right)}\right) \]
      6. *-commutative84.5%

        \[\leadsto x \cdot \left(1 + \left(-\color{blue}{6 \cdot \left(0.6666666666666666 - z\right)}\right)\right) \]
      7. sub-neg84.5%

        \[\leadsto x \cdot \left(1 + \left(-6 \cdot \color{blue}{\left(0.6666666666666666 + \left(-z\right)\right)}\right)\right) \]
      8. distribute-lft-in84.5%

        \[\leadsto x \cdot \left(1 + \left(-\color{blue}{\left(6 \cdot 0.6666666666666666 + 6 \cdot \left(-z\right)\right)}\right)\right) \]
      9. metadata-eval84.5%

        \[\leadsto x \cdot \left(1 + \left(-\left(\color{blue}{4} + 6 \cdot \left(-z\right)\right)\right)\right) \]
      10. distribute-rgt-neg-out84.5%

        \[\leadsto x \cdot \left(1 + \left(-\left(4 + \color{blue}{\left(-6 \cdot z\right)}\right)\right)\right) \]
      11. distribute-lft-neg-in84.5%

        \[\leadsto x \cdot \left(1 + \left(-\left(4 + \color{blue}{\left(-6\right) \cdot z}\right)\right)\right) \]
      12. metadata-eval84.5%

        \[\leadsto x \cdot \left(1 + \left(-\left(4 + \color{blue}{-6} \cdot z\right)\right)\right) \]
      13. mul-1-neg84.5%

        \[\leadsto x \cdot \left(1 + \color{blue}{-1 \cdot \left(4 + -6 \cdot z\right)}\right) \]
      14. distribute-lft-in84.5%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-1 \cdot 4 + -1 \cdot \left(-6 \cdot z\right)\right)}\right) \]
      15. metadata-eval84.5%

        \[\leadsto x \cdot \left(1 + \left(\color{blue}{-4} + -1 \cdot \left(-6 \cdot z\right)\right)\right) \]
      16. associate-+r+84.5%

        \[\leadsto x \cdot \color{blue}{\left(\left(1 + -4\right) + -1 \cdot \left(-6 \cdot z\right)\right)} \]
      17. metadata-eval84.5%

        \[\leadsto x \cdot \left(\color{blue}{-3} + -1 \cdot \left(-6 \cdot z\right)\right) \]
      18. associate-*r*84.5%

        \[\leadsto x \cdot \left(-3 + \color{blue}{\left(-1 \cdot -6\right) \cdot z}\right) \]
      19. metadata-eval84.5%

        \[\leadsto x \cdot \left(-3 + \color{blue}{6} \cdot z\right) \]
      20. *-commutative84.5%

        \[\leadsto x \cdot \left(-3 + \color{blue}{z \cdot 6}\right) \]
    7. Simplified84.5%

      \[\leadsto \color{blue}{x \cdot \left(-3 + z \cdot 6\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification81.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.6 \cdot 10^{+28} \lor \neg \left(y \leq 1.06 \cdot 10^{-36}\right):\\ \;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 99.7% accurate, 0.9× speedup?

\[\begin{array}{l} \\ x + \left(-6 \cdot \left(\left(y - x\right) \cdot z\right) + \left(y - x\right) \cdot 4\right) \end{array} \]
(FPCore (x y z)
 :precision binary64
 (+ x (+ (* -6.0 (* (- y x) z)) (* (- y x) 4.0))))
double code(double x, double y, double z) {
	return x + ((-6.0 * ((y - x) * z)) + ((y - x) * 4.0));
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = x + (((-6.0d0) * ((y - x) * z)) + ((y - x) * 4.0d0))
end function
public static double code(double x, double y, double z) {
	return x + ((-6.0 * ((y - x) * z)) + ((y - x) * 4.0));
}
def code(x, y, z):
	return x + ((-6.0 * ((y - x) * z)) + ((y - x) * 4.0))
function code(x, y, z)
	return Float64(x + Float64(Float64(-6.0 * Float64(Float64(y - x) * z)) + Float64(Float64(y - x) * 4.0)))
end
function tmp = code(x, y, z)
	tmp = x + ((-6.0 * ((y - x) * z)) + ((y - x) * 4.0));
end
code[x_, y_, z_] := N[(x + N[(N[(-6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] + N[(N[(y - x), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x + \left(-6 \cdot \left(\left(y - x\right) \cdot z\right) + \left(y - x\right) \cdot 4\right)
\end{array}
Derivation
  1. Initial program 99.2%

    \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
  2. Step-by-step derivation
    1. metadata-eval99.2%

      \[\leadsto x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\color{blue}{0.6666666666666666} - z\right) \]
  3. Simplified99.2%

    \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
  4. Add Preprocessing
  5. Taylor expanded in z around 0 99.8%

    \[\leadsto x + \color{blue}{\left(-6 \cdot \left(z \cdot \left(y - x\right)\right) + 4 \cdot \left(y - x\right)\right)} \]
  6. Final simplification99.8%

    \[\leadsto x + \left(-6 \cdot \left(\left(y - x\right) \cdot z\right) + \left(y - x\right) \cdot 4\right) \]
  7. Add Preprocessing

Alternative 10: 37.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.2 \cdot 10^{+28} \lor \neg \left(y \leq 3.7 \cdot 10^{-34}\right):\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;x \cdot -3\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= y -1.2e+28) (not (<= y 3.7e-34))) (* y 4.0) (* x -3.0)))
double code(double x, double y, double z) {
	double tmp;
	if ((y <= -1.2e+28) || !(y <= 3.7e-34)) {
		tmp = y * 4.0;
	} else {
		tmp = x * -3.0;
	}
	return tmp;
}
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 <= (-1.2d+28)) .or. (.not. (y <= 3.7d-34))) then
        tmp = y * 4.0d0
    else
        tmp = x * (-3.0d0)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((y <= -1.2e+28) || !(y <= 3.7e-34)) {
		tmp = y * 4.0;
	} else {
		tmp = x * -3.0;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (y <= -1.2e+28) or not (y <= 3.7e-34):
		tmp = y * 4.0
	else:
		tmp = x * -3.0
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((y <= -1.2e+28) || !(y <= 3.7e-34))
		tmp = Float64(y * 4.0);
	else
		tmp = Float64(x * -3.0);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((y <= -1.2e+28) || ~((y <= 3.7e-34)))
		tmp = y * 4.0;
	else
		tmp = x * -3.0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.2e+28], N[Not[LessEqual[y, 3.7e-34]], $MachinePrecision]], N[(y * 4.0), $MachinePrecision], N[(x * -3.0), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.2 \cdot 10^{+28} \lor \neg \left(y \leq 3.7 \cdot 10^{-34}\right):\\
\;\;\;\;y \cdot 4\\

\mathbf{else}:\\
\;\;\;\;x \cdot -3\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.19999999999999991e28 or 3.69999999999999988e-34 < y

    1. Initial program 99.0%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Step-by-step derivation
      1. metadata-eval99.0%

        \[\leadsto x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\color{blue}{0.6666666666666666} - z\right) \]
    3. Simplified99.0%

      \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in z around 0 48.5%

      \[\leadsto x + \color{blue}{4 \cdot \left(y - x\right)} \]
    6. Taylor expanded in x around 0 38.4%

      \[\leadsto \color{blue}{4 \cdot y} \]
    7. Step-by-step derivation
      1. *-commutative38.4%

        \[\leadsto \color{blue}{y \cdot 4} \]
    8. Simplified38.4%

      \[\leadsto \color{blue}{y \cdot 4} \]

    if -1.19999999999999991e28 < y < 3.69999999999999988e-34

    1. Initial program 99.4%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Step-by-step derivation
      1. metadata-eval99.4%

        \[\leadsto x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\color{blue}{0.6666666666666666} - z\right) \]
    3. Simplified99.4%

      \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 83.8%

      \[\leadsto \color{blue}{x \cdot \left(1 + -6 \cdot \left(0.6666666666666666 - z\right)\right)} \]
    6. Step-by-step derivation
      1. metadata-eval83.8%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6\right)} \cdot \left(0.6666666666666666 - z\right)\right) \]
      2. cancel-sign-sub-inv83.8%

        \[\leadsto x \cdot \color{blue}{\left(1 - 6 \cdot \left(0.6666666666666666 - z\right)\right)} \]
      3. *-commutative83.8%

        \[\leadsto x \cdot \left(1 - \color{blue}{\left(0.6666666666666666 - z\right) \cdot 6}\right) \]
      4. cancel-sign-sub-inv83.8%

        \[\leadsto x \cdot \color{blue}{\left(1 + \left(-\left(0.6666666666666666 - z\right)\right) \cdot 6\right)} \]
      5. distribute-lft-neg-in83.8%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-\left(0.6666666666666666 - z\right) \cdot 6\right)}\right) \]
      6. *-commutative83.8%

        \[\leadsto x \cdot \left(1 + \left(-\color{blue}{6 \cdot \left(0.6666666666666666 - z\right)}\right)\right) \]
      7. sub-neg83.8%

        \[\leadsto x \cdot \left(1 + \left(-6 \cdot \color{blue}{\left(0.6666666666666666 + \left(-z\right)\right)}\right)\right) \]
      8. distribute-lft-in83.8%

        \[\leadsto x \cdot \left(1 + \left(-\color{blue}{\left(6 \cdot 0.6666666666666666 + 6 \cdot \left(-z\right)\right)}\right)\right) \]
      9. metadata-eval83.8%

        \[\leadsto x \cdot \left(1 + \left(-\left(\color{blue}{4} + 6 \cdot \left(-z\right)\right)\right)\right) \]
      10. distribute-rgt-neg-out83.8%

        \[\leadsto x \cdot \left(1 + \left(-\left(4 + \color{blue}{\left(-6 \cdot z\right)}\right)\right)\right) \]
      11. distribute-lft-neg-in83.8%

        \[\leadsto x \cdot \left(1 + \left(-\left(4 + \color{blue}{\left(-6\right) \cdot z}\right)\right)\right) \]
      12. metadata-eval83.8%

        \[\leadsto x \cdot \left(1 + \left(-\left(4 + \color{blue}{-6} \cdot z\right)\right)\right) \]
      13. mul-1-neg83.8%

        \[\leadsto x \cdot \left(1 + \color{blue}{-1 \cdot \left(4 + -6 \cdot z\right)}\right) \]
      14. distribute-lft-in83.8%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-1 \cdot 4 + -1 \cdot \left(-6 \cdot z\right)\right)}\right) \]
      15. metadata-eval83.8%

        \[\leadsto x \cdot \left(1 + \left(\color{blue}{-4} + -1 \cdot \left(-6 \cdot z\right)\right)\right) \]
      16. associate-+r+83.8%

        \[\leadsto x \cdot \color{blue}{\left(\left(1 + -4\right) + -1 \cdot \left(-6 \cdot z\right)\right)} \]
      17. metadata-eval83.8%

        \[\leadsto x \cdot \left(\color{blue}{-3} + -1 \cdot \left(-6 \cdot z\right)\right) \]
      18. associate-*r*83.8%

        \[\leadsto x \cdot \left(-3 + \color{blue}{\left(-1 \cdot -6\right) \cdot z}\right) \]
      19. metadata-eval83.8%

        \[\leadsto x \cdot \left(-3 + \color{blue}{6} \cdot z\right) \]
      20. *-commutative83.8%

        \[\leadsto x \cdot \left(-3 + \color{blue}{z \cdot 6}\right) \]
    7. Simplified83.8%

      \[\leadsto \color{blue}{x \cdot \left(-3 + z \cdot 6\right)} \]
    8. Taylor expanded in z around 0 45.9%

      \[\leadsto \color{blue}{-3 \cdot x} \]
    9. Step-by-step derivation
      1. *-commutative45.9%

        \[\leadsto \color{blue}{x \cdot -3} \]
    10. Simplified45.9%

      \[\leadsto \color{blue}{x \cdot -3} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification42.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.2 \cdot 10^{+28} \lor \neg \left(y \leq 3.7 \cdot 10^{-34}\right):\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;x \cdot -3\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 99.5% accurate, 1.2× speedup?

\[\begin{array}{l} \\ x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right) \end{array} \]
(FPCore (x y z)
 :precision binary64
 (+ x (* (* (- y x) 6.0) (- 0.6666666666666666 z))))
double code(double x, double y, double z) {
	return x + (((y - x) * 6.0) * (0.6666666666666666 - z));
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = x + (((y - x) * 6.0d0) * (0.6666666666666666d0 - z))
end function
public static double code(double x, double y, double z) {
	return x + (((y - x) * 6.0) * (0.6666666666666666 - z));
}
def code(x, y, z):
	return x + (((y - x) * 6.0) * (0.6666666666666666 - z))
function code(x, y, z)
	return Float64(x + Float64(Float64(Float64(y - x) * 6.0) * Float64(0.6666666666666666 - z)))
end
function tmp = code(x, y, z)
	tmp = x + (((y - x) * 6.0) * (0.6666666666666666 - z));
end
code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * N[(0.6666666666666666 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)
\end{array}
Derivation
  1. Initial program 99.2%

    \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
  2. Step-by-step derivation
    1. metadata-eval99.2%

      \[\leadsto x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\color{blue}{0.6666666666666666} - z\right) \]
  3. Simplified99.2%

    \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
  4. Add Preprocessing
  5. Add Preprocessing

Alternative 12: 26.0% accurate, 4.3× speedup?

\[\begin{array}{l} \\ x \cdot -3 \end{array} \]
(FPCore (x y z) :precision binary64 (* x -3.0))
double code(double x, double y, double z) {
	return x * -3.0;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = x * (-3.0d0)
end function
public static double code(double x, double y, double z) {
	return x * -3.0;
}
def code(x, y, z):
	return x * -3.0
function code(x, y, z)
	return Float64(x * -3.0)
end
function tmp = code(x, y, z)
	tmp = x * -3.0;
end
code[x_, y_, z_] := N[(x * -3.0), $MachinePrecision]
\begin{array}{l}

\\
x \cdot -3
\end{array}
Derivation
  1. Initial program 99.2%

    \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
  2. Step-by-step derivation
    1. metadata-eval99.2%

      \[\leadsto x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\color{blue}{0.6666666666666666} - z\right) \]
  3. Simplified99.2%

    \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
  4. Add Preprocessing
  5. Taylor expanded in x around inf 53.6%

    \[\leadsto \color{blue}{x \cdot \left(1 + -6 \cdot \left(0.6666666666666666 - z\right)\right)} \]
  6. Step-by-step derivation
    1. metadata-eval53.6%

      \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6\right)} \cdot \left(0.6666666666666666 - z\right)\right) \]
    2. cancel-sign-sub-inv53.6%

      \[\leadsto x \cdot \color{blue}{\left(1 - 6 \cdot \left(0.6666666666666666 - z\right)\right)} \]
    3. *-commutative53.6%

      \[\leadsto x \cdot \left(1 - \color{blue}{\left(0.6666666666666666 - z\right) \cdot 6}\right) \]
    4. cancel-sign-sub-inv53.6%

      \[\leadsto x \cdot \color{blue}{\left(1 + \left(-\left(0.6666666666666666 - z\right)\right) \cdot 6\right)} \]
    5. distribute-lft-neg-in53.6%

      \[\leadsto x \cdot \left(1 + \color{blue}{\left(-\left(0.6666666666666666 - z\right) \cdot 6\right)}\right) \]
    6. *-commutative53.6%

      \[\leadsto x \cdot \left(1 + \left(-\color{blue}{6 \cdot \left(0.6666666666666666 - z\right)}\right)\right) \]
    7. sub-neg53.6%

      \[\leadsto x \cdot \left(1 + \left(-6 \cdot \color{blue}{\left(0.6666666666666666 + \left(-z\right)\right)}\right)\right) \]
    8. distribute-lft-in53.6%

      \[\leadsto x \cdot \left(1 + \left(-\color{blue}{\left(6 \cdot 0.6666666666666666 + 6 \cdot \left(-z\right)\right)}\right)\right) \]
    9. metadata-eval53.6%

      \[\leadsto x \cdot \left(1 + \left(-\left(\color{blue}{4} + 6 \cdot \left(-z\right)\right)\right)\right) \]
    10. distribute-rgt-neg-out53.6%

      \[\leadsto x \cdot \left(1 + \left(-\left(4 + \color{blue}{\left(-6 \cdot z\right)}\right)\right)\right) \]
    11. distribute-lft-neg-in53.6%

      \[\leadsto x \cdot \left(1 + \left(-\left(4 + \color{blue}{\left(-6\right) \cdot z}\right)\right)\right) \]
    12. metadata-eval53.6%

      \[\leadsto x \cdot \left(1 + \left(-\left(4 + \color{blue}{-6} \cdot z\right)\right)\right) \]
    13. mul-1-neg53.6%

      \[\leadsto x \cdot \left(1 + \color{blue}{-1 \cdot \left(4 + -6 \cdot z\right)}\right) \]
    14. distribute-lft-in53.6%

      \[\leadsto x \cdot \left(1 + \color{blue}{\left(-1 \cdot 4 + -1 \cdot \left(-6 \cdot z\right)\right)}\right) \]
    15. metadata-eval53.6%

      \[\leadsto x \cdot \left(1 + \left(\color{blue}{-4} + -1 \cdot \left(-6 \cdot z\right)\right)\right) \]
    16. associate-+r+53.6%

      \[\leadsto x \cdot \color{blue}{\left(\left(1 + -4\right) + -1 \cdot \left(-6 \cdot z\right)\right)} \]
    17. metadata-eval53.6%

      \[\leadsto x \cdot \left(\color{blue}{-3} + -1 \cdot \left(-6 \cdot z\right)\right) \]
    18. associate-*r*53.6%

      \[\leadsto x \cdot \left(-3 + \color{blue}{\left(-1 \cdot -6\right) \cdot z}\right) \]
    19. metadata-eval53.6%

      \[\leadsto x \cdot \left(-3 + \color{blue}{6} \cdot z\right) \]
    20. *-commutative53.6%

      \[\leadsto x \cdot \left(-3 + \color{blue}{z \cdot 6}\right) \]
  7. Simplified53.6%

    \[\leadsto \color{blue}{x \cdot \left(-3 + z \cdot 6\right)} \]
  8. Taylor expanded in z around 0 28.4%

    \[\leadsto \color{blue}{-3 \cdot x} \]
  9. Step-by-step derivation
    1. *-commutative28.4%

      \[\leadsto \color{blue}{x \cdot -3} \]
  10. Simplified28.4%

    \[\leadsto \color{blue}{x \cdot -3} \]
  11. Add Preprocessing

Alternative 13: 2.6% accurate, 13.0× speedup?

\[\begin{array}{l} \\ x \end{array} \]
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
	return x;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = x
end function
public static double code(double x, double y, double z) {
	return x;
}
def code(x, y, z):
	return x
function code(x, y, z)
	return x
end
function tmp = code(x, y, z)
	tmp = x;
end
code[x_, y_, z_] := x
\begin{array}{l}

\\
x
\end{array}
Derivation
  1. Initial program 99.2%

    \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
  2. Step-by-step derivation
    1. metadata-eval99.2%

      \[\leadsto x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\color{blue}{0.6666666666666666} - z\right) \]
  3. Simplified99.2%

    \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
  4. Add Preprocessing
  5. Taylor expanded in z around inf 50.8%

    \[\leadsto x + \color{blue}{-6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
  6. Taylor expanded in z around 0 2.7%

    \[\leadsto \color{blue}{x} \]
  7. Add Preprocessing

Reproduce

?
herbie shell --seed 2024084 
(FPCore (x y z)
  :name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, D"
  :precision binary64
  (+ x (* (* (- y x) 6.0) (- (/ 2.0 3.0) z))))