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

Percentage Accurate: 99.5% → 99.8%
Time: 10.8s
Alternatives: 16
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 16 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.3%

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

      \[\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. Final simplification99.8%

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

Alternative 2: 50.1% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -6 \cdot \left(y \cdot z\right)\\ t_1 := 6 \cdot \left(x \cdot z\right)\\ \mathbf{if}\;z \leq -1.3 \cdot 10^{+94}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -430000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -3.1 \cdot 10^{-23}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -7.2 \cdot 10^{-122}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -4.6 \cdot 10^{-206}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.65:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 4.6 \cdot 10^{+64} \lor \neg \left(z \leq 7.5 \cdot 10^{+145}\right) \land z \leq 5.6 \cdot 10^{+214}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* -6.0 (* y z))) (t_1 (* 6.0 (* x z))))
   (if (<= z -1.3e+94)
     t_0
     (if (<= z -430000.0)
       t_1
       (if (<= z -3.1e-23)
         (* x -3.0)
         (if (<= z -7.2e-122)
           (* y 4.0)
           (if (<= z -4.6e-206)
             (* x -3.0)
             (if (<= z 0.65)
               (* y 4.0)
               (if (or (<= z 4.6e+64)
                       (and (not (<= z 7.5e+145)) (<= z 5.6e+214)))
                 t_0
                 t_1)))))))))
double code(double x, double y, double z) {
	double t_0 = -6.0 * (y * z);
	double t_1 = 6.0 * (x * z);
	double tmp;
	if (z <= -1.3e+94) {
		tmp = t_0;
	} else if (z <= -430000.0) {
		tmp = t_1;
	} else if (z <= -3.1e-23) {
		tmp = x * -3.0;
	} else if (z <= -7.2e-122) {
		tmp = y * 4.0;
	} else if (z <= -4.6e-206) {
		tmp = x * -3.0;
	} else if (z <= 0.65) {
		tmp = y * 4.0;
	} else if ((z <= 4.6e+64) || (!(z <= 7.5e+145) && (z <= 5.6e+214))) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	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) :: t_1
    real(8) :: tmp
    t_0 = (-6.0d0) * (y * z)
    t_1 = 6.0d0 * (x * z)
    if (z <= (-1.3d+94)) then
        tmp = t_0
    else if (z <= (-430000.0d0)) then
        tmp = t_1
    else if (z <= (-3.1d-23)) then
        tmp = x * (-3.0d0)
    else if (z <= (-7.2d-122)) then
        tmp = y * 4.0d0
    else if (z <= (-4.6d-206)) then
        tmp = x * (-3.0d0)
    else if (z <= 0.65d0) then
        tmp = y * 4.0d0
    else if ((z <= 4.6d+64) .or. (.not. (z <= 7.5d+145)) .and. (z <= 5.6d+214)) then
        tmp = t_0
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = -6.0 * (y * z);
	double t_1 = 6.0 * (x * z);
	double tmp;
	if (z <= -1.3e+94) {
		tmp = t_0;
	} else if (z <= -430000.0) {
		tmp = t_1;
	} else if (z <= -3.1e-23) {
		tmp = x * -3.0;
	} else if (z <= -7.2e-122) {
		tmp = y * 4.0;
	} else if (z <= -4.6e-206) {
		tmp = x * -3.0;
	} else if (z <= 0.65) {
		tmp = y * 4.0;
	} else if ((z <= 4.6e+64) || (!(z <= 7.5e+145) && (z <= 5.6e+214))) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = -6.0 * (y * z)
	t_1 = 6.0 * (x * z)
	tmp = 0
	if z <= -1.3e+94:
		tmp = t_0
	elif z <= -430000.0:
		tmp = t_1
	elif z <= -3.1e-23:
		tmp = x * -3.0
	elif z <= -7.2e-122:
		tmp = y * 4.0
	elif z <= -4.6e-206:
		tmp = x * -3.0
	elif z <= 0.65:
		tmp = y * 4.0
	elif (z <= 4.6e+64) or (not (z <= 7.5e+145) and (z <= 5.6e+214)):
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(-6.0 * Float64(y * z))
	t_1 = Float64(6.0 * Float64(x * z))
	tmp = 0.0
	if (z <= -1.3e+94)
		tmp = t_0;
	elseif (z <= -430000.0)
		tmp = t_1;
	elseif (z <= -3.1e-23)
		tmp = Float64(x * -3.0);
	elseif (z <= -7.2e-122)
		tmp = Float64(y * 4.0);
	elseif (z <= -4.6e-206)
		tmp = Float64(x * -3.0);
	elseif (z <= 0.65)
		tmp = Float64(y * 4.0);
	elseif ((z <= 4.6e+64) || (!(z <= 7.5e+145) && (z <= 5.6e+214)))
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = -6.0 * (y * z);
	t_1 = 6.0 * (x * z);
	tmp = 0.0;
	if (z <= -1.3e+94)
		tmp = t_0;
	elseif (z <= -430000.0)
		tmp = t_1;
	elseif (z <= -3.1e-23)
		tmp = x * -3.0;
	elseif (z <= -7.2e-122)
		tmp = y * 4.0;
	elseif (z <= -4.6e-206)
		tmp = x * -3.0;
	elseif (z <= 0.65)
		tmp = y * 4.0;
	elseif ((z <= 4.6e+64) || (~((z <= 7.5e+145)) && (z <= 5.6e+214)))
		tmp = t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(-6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.3e+94], t$95$0, If[LessEqual[z, -430000.0], t$95$1, If[LessEqual[z, -3.1e-23], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, -7.2e-122], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, -4.6e-206], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 0.65], N[(y * 4.0), $MachinePrecision], If[Or[LessEqual[z, 4.6e+64], And[N[Not[LessEqual[z, 7.5e+145]], $MachinePrecision], LessEqual[z, 5.6e+214]]], t$95$0, t$95$1]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := -6 \cdot \left(y \cdot z\right)\\
t_1 := 6 \cdot \left(x \cdot z\right)\\
\mathbf{if}\;z \leq -1.3 \cdot 10^{+94}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq -430000:\\
\;\;\;\;t\_1\\

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

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

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

\mathbf{elif}\;z \leq 0.65:\\
\;\;\;\;y \cdot 4\\

\mathbf{elif}\;z \leq 4.6 \cdot 10^{+64} \lor \neg \left(z \leq 7.5 \cdot 10^{+145}\right) \land z \leq 5.6 \cdot 10^{+214}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -1.3e94 or 0.650000000000000022 < z < 4.6e64 or 7.50000000000000006e145 < z < 5.5999999999999996e214

    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 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. Taylor expanded in z around inf 98.5%

      \[\leadsto \color{blue}{-6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
    7. Step-by-step derivation
      1. associate-*r*98.6%

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

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

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

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

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

        \[\leadsto -6 \cdot \color{blue}{\left(z \cdot y\right)} \]
    11. Simplified68.1%

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

    if -1.3e94 < z < -4.3e5 or 4.6e64 < z < 7.50000000000000006e145 or 5.5999999999999996e214 < 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 0 99.6%

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

      \[\leadsto \color{blue}{-6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
    7. Step-by-step derivation
      1. associate-*r*99.1%

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

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

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

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

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

    if -4.3e5 < z < -3.0999999999999999e-23 or -7.19999999999999989e-122 < z < -4.6e-206

    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 60.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.0999999999999999e-23 < z < -7.19999999999999989e-122 or -4.6e-206 < 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 x around 0 99.5%

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

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

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

        \[\leadsto \color{blue}{y \cdot 4} \]
    9. Simplified54.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.3 \cdot 10^{+94}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -430000:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -3.1 \cdot 10^{-23}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -7.2 \cdot 10^{-122}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -4.6 \cdot 10^{-206}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.65:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 4.6 \cdot 10^{+64} \lor \neg \left(z \leq 7.5 \cdot 10^{+145}\right) \land z \leq 5.6 \cdot 10^{+214}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 50.1% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -6 \cdot \left(y \cdot z\right)\\ t_1 := 6 \cdot \left(x \cdot z\right)\\ \mathbf{if}\;z \leq -1.95 \cdot 10^{+93}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -430000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -3.5 \cdot 10^{-27}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -8 \cdot 10^{-121}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -3.6 \cdot 10^{-208}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.65:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 2.4 \cdot 10^{+64}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 1.82 \cdot 10^{+148}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq 1.6 \cdot 10^{+212}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* -6.0 (* y z))) (t_1 (* 6.0 (* x z))))
   (if (<= z -1.95e+93)
     t_0
     (if (<= z -430000.0)
       t_1
       (if (<= z -3.5e-27)
         (* x -3.0)
         (if (<= z -8e-121)
           (* y 4.0)
           (if (<= z -3.6e-208)
             (* x -3.0)
             (if (<= z 0.65)
               (* y 4.0)
               (if (<= z 2.4e+64)
                 t_0
                 (if (<= z 1.82e+148)
                   (* x (* z 6.0))
                   (if (<= z 1.6e+212) t_0 t_1)))))))))))
double code(double x, double y, double z) {
	double t_0 = -6.0 * (y * z);
	double t_1 = 6.0 * (x * z);
	double tmp;
	if (z <= -1.95e+93) {
		tmp = t_0;
	} else if (z <= -430000.0) {
		tmp = t_1;
	} else if (z <= -3.5e-27) {
		tmp = x * -3.0;
	} else if (z <= -8e-121) {
		tmp = y * 4.0;
	} else if (z <= -3.6e-208) {
		tmp = x * -3.0;
	} else if (z <= 0.65) {
		tmp = y * 4.0;
	} else if (z <= 2.4e+64) {
		tmp = t_0;
	} else if (z <= 1.82e+148) {
		tmp = x * (z * 6.0);
	} else if (z <= 1.6e+212) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	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) :: t_1
    real(8) :: tmp
    t_0 = (-6.0d0) * (y * z)
    t_1 = 6.0d0 * (x * z)
    if (z <= (-1.95d+93)) then
        tmp = t_0
    else if (z <= (-430000.0d0)) then
        tmp = t_1
    else if (z <= (-3.5d-27)) then
        tmp = x * (-3.0d0)
    else if (z <= (-8d-121)) then
        tmp = y * 4.0d0
    else if (z <= (-3.6d-208)) then
        tmp = x * (-3.0d0)
    else if (z <= 0.65d0) then
        tmp = y * 4.0d0
    else if (z <= 2.4d+64) then
        tmp = t_0
    else if (z <= 1.82d+148) then
        tmp = x * (z * 6.0d0)
    else if (z <= 1.6d+212) then
        tmp = t_0
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = -6.0 * (y * z);
	double t_1 = 6.0 * (x * z);
	double tmp;
	if (z <= -1.95e+93) {
		tmp = t_0;
	} else if (z <= -430000.0) {
		tmp = t_1;
	} else if (z <= -3.5e-27) {
		tmp = x * -3.0;
	} else if (z <= -8e-121) {
		tmp = y * 4.0;
	} else if (z <= -3.6e-208) {
		tmp = x * -3.0;
	} else if (z <= 0.65) {
		tmp = y * 4.0;
	} else if (z <= 2.4e+64) {
		tmp = t_0;
	} else if (z <= 1.82e+148) {
		tmp = x * (z * 6.0);
	} else if (z <= 1.6e+212) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = -6.0 * (y * z)
	t_1 = 6.0 * (x * z)
	tmp = 0
	if z <= -1.95e+93:
		tmp = t_0
	elif z <= -430000.0:
		tmp = t_1
	elif z <= -3.5e-27:
		tmp = x * -3.0
	elif z <= -8e-121:
		tmp = y * 4.0
	elif z <= -3.6e-208:
		tmp = x * -3.0
	elif z <= 0.65:
		tmp = y * 4.0
	elif z <= 2.4e+64:
		tmp = t_0
	elif z <= 1.82e+148:
		tmp = x * (z * 6.0)
	elif z <= 1.6e+212:
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(-6.0 * Float64(y * z))
	t_1 = Float64(6.0 * Float64(x * z))
	tmp = 0.0
	if (z <= -1.95e+93)
		tmp = t_0;
	elseif (z <= -430000.0)
		tmp = t_1;
	elseif (z <= -3.5e-27)
		tmp = Float64(x * -3.0);
	elseif (z <= -8e-121)
		tmp = Float64(y * 4.0);
	elseif (z <= -3.6e-208)
		tmp = Float64(x * -3.0);
	elseif (z <= 0.65)
		tmp = Float64(y * 4.0);
	elseif (z <= 2.4e+64)
		tmp = t_0;
	elseif (z <= 1.82e+148)
		tmp = Float64(x * Float64(z * 6.0));
	elseif (z <= 1.6e+212)
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = -6.0 * (y * z);
	t_1 = 6.0 * (x * z);
	tmp = 0.0;
	if (z <= -1.95e+93)
		tmp = t_0;
	elseif (z <= -430000.0)
		tmp = t_1;
	elseif (z <= -3.5e-27)
		tmp = x * -3.0;
	elseif (z <= -8e-121)
		tmp = y * 4.0;
	elseif (z <= -3.6e-208)
		tmp = x * -3.0;
	elseif (z <= 0.65)
		tmp = y * 4.0;
	elseif (z <= 2.4e+64)
		tmp = t_0;
	elseif (z <= 1.82e+148)
		tmp = x * (z * 6.0);
	elseif (z <= 1.6e+212)
		tmp = t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(-6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.95e+93], t$95$0, If[LessEqual[z, -430000.0], t$95$1, If[LessEqual[z, -3.5e-27], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, -8e-121], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, -3.6e-208], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 0.65], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 2.4e+64], t$95$0, If[LessEqual[z, 1.82e+148], N[(x * N[(z * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.6e+212], t$95$0, t$95$1]]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := -6 \cdot \left(y \cdot z\right)\\
t_1 := 6 \cdot \left(x \cdot z\right)\\
\mathbf{if}\;z \leq -1.95 \cdot 10^{+93}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq -430000:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;z \leq -8 \cdot 10^{-121}:\\
\;\;\;\;y \cdot 4\\

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

\mathbf{elif}\;z \leq 0.65:\\
\;\;\;\;y \cdot 4\\

\mathbf{elif}\;z \leq 2.4 \cdot 10^{+64}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq 1.82 \cdot 10^{+148}:\\
\;\;\;\;x \cdot \left(z \cdot 6\right)\\

\mathbf{elif}\;z \leq 1.6 \cdot 10^{+212}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if z < -1.9500000000000001e93 or 0.650000000000000022 < z < 2.39999999999999999e64 or 1.8200000000000001e148 < z < 1.5999999999999999e212

    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 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. Taylor expanded in z around inf 98.5%

      \[\leadsto \color{blue}{-6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
    7. Step-by-step derivation
      1. associate-*r*98.6%

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

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

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

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

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

        \[\leadsto -6 \cdot \color{blue}{\left(z \cdot y\right)} \]
    11. Simplified68.1%

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

    if -1.9500000000000001e93 < z < -4.3e5 or 1.5999999999999999e212 < z

    1. Initial program 99.8%

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

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

      \[\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. Taylor expanded in z around inf 98.9%

      \[\leadsto \color{blue}{-6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
    7. Step-by-step derivation
      1. associate-*r*98.8%

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

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

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

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

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

    if -4.3e5 < z < -3.5000000000000001e-27 or -7.9999999999999998e-121 < z < -3.5999999999999998e-208

    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 60.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.5000000000000001e-27 < z < -7.9999999999999998e-121 or -3.5999999999999998e-208 < 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 x around 0 99.5%

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

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

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

        \[\leadsto \color{blue}{y \cdot 4} \]
    9. Simplified54.7%

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

    if 2.39999999999999999e64 < z < 1.8200000000000001e148

    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 65.1%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.95 \cdot 10^{+93}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -430000:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -3.5 \cdot 10^{-27}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -8 \cdot 10^{-121}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -3.6 \cdot 10^{-208}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.65:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 2.4 \cdot 10^{+64}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 1.82 \cdot 10^{+148}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq 1.6 \cdot 10^{+212}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 50.0% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -6 \cdot \left(y \cdot z\right)\\ t_1 := 6 \cdot \left(x \cdot z\right)\\ \mathbf{if}\;z \leq -2.1 \cdot 10^{+93}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -430000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -5.6 \cdot 10^{-27}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -2.6 \cdot 10^{-120}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -4.8 \cdot 10^{-206}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.65:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 9.5 \cdot 10^{+64}:\\ \;\;\;\;y \cdot \left(z \cdot -6\right)\\ \mathbf{elif}\;z \leq 6.5 \cdot 10^{+147}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq 1.2 \cdot 10^{+215}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* -6.0 (* y z))) (t_1 (* 6.0 (* x z))))
   (if (<= z -2.1e+93)
     t_0
     (if (<= z -430000.0)
       t_1
       (if (<= z -5.6e-27)
         (* x -3.0)
         (if (<= z -2.6e-120)
           (* y 4.0)
           (if (<= z -4.8e-206)
             (* x -3.0)
             (if (<= z 0.65)
               (* y 4.0)
               (if (<= z 9.5e+64)
                 (* y (* z -6.0))
                 (if (<= z 6.5e+147)
                   (* x (* z 6.0))
                   (if (<= z 1.2e+215) t_0 t_1)))))))))))
double code(double x, double y, double z) {
	double t_0 = -6.0 * (y * z);
	double t_1 = 6.0 * (x * z);
	double tmp;
	if (z <= -2.1e+93) {
		tmp = t_0;
	} else if (z <= -430000.0) {
		tmp = t_1;
	} else if (z <= -5.6e-27) {
		tmp = x * -3.0;
	} else if (z <= -2.6e-120) {
		tmp = y * 4.0;
	} else if (z <= -4.8e-206) {
		tmp = x * -3.0;
	} else if (z <= 0.65) {
		tmp = y * 4.0;
	} else if (z <= 9.5e+64) {
		tmp = y * (z * -6.0);
	} else if (z <= 6.5e+147) {
		tmp = x * (z * 6.0);
	} else if (z <= 1.2e+215) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	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) :: t_1
    real(8) :: tmp
    t_0 = (-6.0d0) * (y * z)
    t_1 = 6.0d0 * (x * z)
    if (z <= (-2.1d+93)) then
        tmp = t_0
    else if (z <= (-430000.0d0)) then
        tmp = t_1
    else if (z <= (-5.6d-27)) then
        tmp = x * (-3.0d0)
    else if (z <= (-2.6d-120)) then
        tmp = y * 4.0d0
    else if (z <= (-4.8d-206)) then
        tmp = x * (-3.0d0)
    else if (z <= 0.65d0) then
        tmp = y * 4.0d0
    else if (z <= 9.5d+64) then
        tmp = y * (z * (-6.0d0))
    else if (z <= 6.5d+147) then
        tmp = x * (z * 6.0d0)
    else if (z <= 1.2d+215) then
        tmp = t_0
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = -6.0 * (y * z);
	double t_1 = 6.0 * (x * z);
	double tmp;
	if (z <= -2.1e+93) {
		tmp = t_0;
	} else if (z <= -430000.0) {
		tmp = t_1;
	} else if (z <= -5.6e-27) {
		tmp = x * -3.0;
	} else if (z <= -2.6e-120) {
		tmp = y * 4.0;
	} else if (z <= -4.8e-206) {
		tmp = x * -3.0;
	} else if (z <= 0.65) {
		tmp = y * 4.0;
	} else if (z <= 9.5e+64) {
		tmp = y * (z * -6.0);
	} else if (z <= 6.5e+147) {
		tmp = x * (z * 6.0);
	} else if (z <= 1.2e+215) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = -6.0 * (y * z)
	t_1 = 6.0 * (x * z)
	tmp = 0
	if z <= -2.1e+93:
		tmp = t_0
	elif z <= -430000.0:
		tmp = t_1
	elif z <= -5.6e-27:
		tmp = x * -3.0
	elif z <= -2.6e-120:
		tmp = y * 4.0
	elif z <= -4.8e-206:
		tmp = x * -3.0
	elif z <= 0.65:
		tmp = y * 4.0
	elif z <= 9.5e+64:
		tmp = y * (z * -6.0)
	elif z <= 6.5e+147:
		tmp = x * (z * 6.0)
	elif z <= 1.2e+215:
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(-6.0 * Float64(y * z))
	t_1 = Float64(6.0 * Float64(x * z))
	tmp = 0.0
	if (z <= -2.1e+93)
		tmp = t_0;
	elseif (z <= -430000.0)
		tmp = t_1;
	elseif (z <= -5.6e-27)
		tmp = Float64(x * -3.0);
	elseif (z <= -2.6e-120)
		tmp = Float64(y * 4.0);
	elseif (z <= -4.8e-206)
		tmp = Float64(x * -3.0);
	elseif (z <= 0.65)
		tmp = Float64(y * 4.0);
	elseif (z <= 9.5e+64)
		tmp = Float64(y * Float64(z * -6.0));
	elseif (z <= 6.5e+147)
		tmp = Float64(x * Float64(z * 6.0));
	elseif (z <= 1.2e+215)
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = -6.0 * (y * z);
	t_1 = 6.0 * (x * z);
	tmp = 0.0;
	if (z <= -2.1e+93)
		tmp = t_0;
	elseif (z <= -430000.0)
		tmp = t_1;
	elseif (z <= -5.6e-27)
		tmp = x * -3.0;
	elseif (z <= -2.6e-120)
		tmp = y * 4.0;
	elseif (z <= -4.8e-206)
		tmp = x * -3.0;
	elseif (z <= 0.65)
		tmp = y * 4.0;
	elseif (z <= 9.5e+64)
		tmp = y * (z * -6.0);
	elseif (z <= 6.5e+147)
		tmp = x * (z * 6.0);
	elseif (z <= 1.2e+215)
		tmp = t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(-6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.1e+93], t$95$0, If[LessEqual[z, -430000.0], t$95$1, If[LessEqual[z, -5.6e-27], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, -2.6e-120], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, -4.8e-206], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 0.65], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 9.5e+64], N[(y * N[(z * -6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.5e+147], N[(x * N[(z * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.2e+215], t$95$0, t$95$1]]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := -6 \cdot \left(y \cdot z\right)\\
t_1 := 6 \cdot \left(x \cdot z\right)\\
\mathbf{if}\;z \leq -2.1 \cdot 10^{+93}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq -430000:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;z \leq -2.6 \cdot 10^{-120}:\\
\;\;\;\;y \cdot 4\\

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

\mathbf{elif}\;z \leq 0.65:\\
\;\;\;\;y \cdot 4\\

\mathbf{elif}\;z \leq 9.5 \cdot 10^{+64}:\\
\;\;\;\;y \cdot \left(z \cdot -6\right)\\

\mathbf{elif}\;z \leq 6.5 \cdot 10^{+147}:\\
\;\;\;\;x \cdot \left(z \cdot 6\right)\\

\mathbf{elif}\;z \leq 1.2 \cdot 10^{+215}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 6 regimes
  2. if z < -2.0999999999999998e93 or 6.5e147 < z < 1.2e215

    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 0 99.9%

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

      \[\leadsto \color{blue}{-6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
    7. Step-by-step derivation
      1. associate-*r*99.9%

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

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

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

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

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

        \[\leadsto -6 \cdot \color{blue}{\left(z \cdot y\right)} \]
    11. Simplified68.1%

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

    if -2.0999999999999998e93 < z < -4.3e5 or 1.2e215 < z

    1. Initial program 99.8%

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

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

      \[\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. Taylor expanded in z around inf 98.9%

      \[\leadsto \color{blue}{-6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
    7. Step-by-step derivation
      1. associate-*r*98.8%

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

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

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

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

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

    if -4.3e5 < z < -5.5999999999999999e-27 or -2.6000000000000001e-120 < z < -4.7999999999999999e-206

    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 60.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.5999999999999999e-27 < z < -2.6000000000000001e-120 or -4.7999999999999999e-206 < 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 x around 0 99.5%

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

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

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

        \[\leadsto \color{blue}{y \cdot 4} \]
    9. Simplified54.7%

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

    if 0.650000000000000022 < z < 9.50000000000000028e64

    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 z around 0 99.2%

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

      \[\leadsto \color{blue}{-6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
    7. Step-by-step derivation
      1. associate-*r*92.8%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot \left(-6 \cdot z\right)} \]
    11. Simplified68.4%

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

    if 9.50000000000000028e64 < z < 6.5e147

    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 65.1%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.1 \cdot 10^{+93}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -430000:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -5.6 \cdot 10^{-27}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -2.6 \cdot 10^{-120}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -4.8 \cdot 10^{-206}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.65:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 9.5 \cdot 10^{+64}:\\ \;\;\;\;y \cdot \left(z \cdot -6\right)\\ \mathbf{elif}\;z \leq 6.5 \cdot 10^{+147}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq 1.2 \cdot 10^{+215}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 50.0% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -6 \cdot \left(y \cdot z\right)\\ t_1 := z \cdot \left(x \cdot 6\right)\\ \mathbf{if}\;z \leq -2.2 \cdot 10^{+54}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -430000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -6.5 \cdot 10^{-29}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -3.8 \cdot 10^{-116}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -5.4 \cdot 10^{-207}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.65:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 8.2 \cdot 10^{+64}:\\ \;\;\;\;y \cdot \left(z \cdot -6\right)\\ \mathbf{elif}\;z \leq 6.2 \cdot 10^{+146}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq 7.5 \cdot 10^{+210}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* -6.0 (* y z))) (t_1 (* z (* x 6.0))))
   (if (<= z -2.2e+54)
     t_0
     (if (<= z -430000.0)
       t_1
       (if (<= z -6.5e-29)
         (* x -3.0)
         (if (<= z -3.8e-116)
           (* y 4.0)
           (if (<= z -5.4e-207)
             (* x -3.0)
             (if (<= z 0.65)
               (* y 4.0)
               (if (<= z 8.2e+64)
                 (* y (* z -6.0))
                 (if (<= z 6.2e+146)
                   (* x (* z 6.0))
                   (if (<= z 7.5e+210) t_0 t_1)))))))))))
double code(double x, double y, double z) {
	double t_0 = -6.0 * (y * z);
	double t_1 = z * (x * 6.0);
	double tmp;
	if (z <= -2.2e+54) {
		tmp = t_0;
	} else if (z <= -430000.0) {
		tmp = t_1;
	} else if (z <= -6.5e-29) {
		tmp = x * -3.0;
	} else if (z <= -3.8e-116) {
		tmp = y * 4.0;
	} else if (z <= -5.4e-207) {
		tmp = x * -3.0;
	} else if (z <= 0.65) {
		tmp = y * 4.0;
	} else if (z <= 8.2e+64) {
		tmp = y * (z * -6.0);
	} else if (z <= 6.2e+146) {
		tmp = x * (z * 6.0);
	} else if (z <= 7.5e+210) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	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) :: t_1
    real(8) :: tmp
    t_0 = (-6.0d0) * (y * z)
    t_1 = z * (x * 6.0d0)
    if (z <= (-2.2d+54)) then
        tmp = t_0
    else if (z <= (-430000.0d0)) then
        tmp = t_1
    else if (z <= (-6.5d-29)) then
        tmp = x * (-3.0d0)
    else if (z <= (-3.8d-116)) then
        tmp = y * 4.0d0
    else if (z <= (-5.4d-207)) then
        tmp = x * (-3.0d0)
    else if (z <= 0.65d0) then
        tmp = y * 4.0d0
    else if (z <= 8.2d+64) then
        tmp = y * (z * (-6.0d0))
    else if (z <= 6.2d+146) then
        tmp = x * (z * 6.0d0)
    else if (z <= 7.5d+210) then
        tmp = t_0
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = -6.0 * (y * z);
	double t_1 = z * (x * 6.0);
	double tmp;
	if (z <= -2.2e+54) {
		tmp = t_0;
	} else if (z <= -430000.0) {
		tmp = t_1;
	} else if (z <= -6.5e-29) {
		tmp = x * -3.0;
	} else if (z <= -3.8e-116) {
		tmp = y * 4.0;
	} else if (z <= -5.4e-207) {
		tmp = x * -3.0;
	} else if (z <= 0.65) {
		tmp = y * 4.0;
	} else if (z <= 8.2e+64) {
		tmp = y * (z * -6.0);
	} else if (z <= 6.2e+146) {
		tmp = x * (z * 6.0);
	} else if (z <= 7.5e+210) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = -6.0 * (y * z)
	t_1 = z * (x * 6.0)
	tmp = 0
	if z <= -2.2e+54:
		tmp = t_0
	elif z <= -430000.0:
		tmp = t_1
	elif z <= -6.5e-29:
		tmp = x * -3.0
	elif z <= -3.8e-116:
		tmp = y * 4.0
	elif z <= -5.4e-207:
		tmp = x * -3.0
	elif z <= 0.65:
		tmp = y * 4.0
	elif z <= 8.2e+64:
		tmp = y * (z * -6.0)
	elif z <= 6.2e+146:
		tmp = x * (z * 6.0)
	elif z <= 7.5e+210:
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(-6.0 * Float64(y * z))
	t_1 = Float64(z * Float64(x * 6.0))
	tmp = 0.0
	if (z <= -2.2e+54)
		tmp = t_0;
	elseif (z <= -430000.0)
		tmp = t_1;
	elseif (z <= -6.5e-29)
		tmp = Float64(x * -3.0);
	elseif (z <= -3.8e-116)
		tmp = Float64(y * 4.0);
	elseif (z <= -5.4e-207)
		tmp = Float64(x * -3.0);
	elseif (z <= 0.65)
		tmp = Float64(y * 4.0);
	elseif (z <= 8.2e+64)
		tmp = Float64(y * Float64(z * -6.0));
	elseif (z <= 6.2e+146)
		tmp = Float64(x * Float64(z * 6.0));
	elseif (z <= 7.5e+210)
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = -6.0 * (y * z);
	t_1 = z * (x * 6.0);
	tmp = 0.0;
	if (z <= -2.2e+54)
		tmp = t_0;
	elseif (z <= -430000.0)
		tmp = t_1;
	elseif (z <= -6.5e-29)
		tmp = x * -3.0;
	elseif (z <= -3.8e-116)
		tmp = y * 4.0;
	elseif (z <= -5.4e-207)
		tmp = x * -3.0;
	elseif (z <= 0.65)
		tmp = y * 4.0;
	elseif (z <= 8.2e+64)
		tmp = y * (z * -6.0);
	elseif (z <= 6.2e+146)
		tmp = x * (z * 6.0);
	elseif (z <= 7.5e+210)
		tmp = t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(-6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(z * N[(x * 6.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.2e+54], t$95$0, If[LessEqual[z, -430000.0], t$95$1, If[LessEqual[z, -6.5e-29], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, -3.8e-116], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, -5.4e-207], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 0.65], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 8.2e+64], N[(y * N[(z * -6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.2e+146], N[(x * N[(z * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.5e+210], t$95$0, t$95$1]]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := -6 \cdot \left(y \cdot z\right)\\
t_1 := z \cdot \left(x \cdot 6\right)\\
\mathbf{if}\;z \leq -2.2 \cdot 10^{+54}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq -430000:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;z \leq -3.8 \cdot 10^{-116}:\\
\;\;\;\;y \cdot 4\\

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

\mathbf{elif}\;z \leq 0.65:\\
\;\;\;\;y \cdot 4\\

\mathbf{elif}\;z \leq 8.2 \cdot 10^{+64}:\\
\;\;\;\;y \cdot \left(z \cdot -6\right)\\

\mathbf{elif}\;z \leq 6.2 \cdot 10^{+146}:\\
\;\;\;\;x \cdot \left(z \cdot 6\right)\\

\mathbf{elif}\;z \leq 7.5 \cdot 10^{+210}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 6 regimes
  2. if z < -2.1999999999999999e54 or 6.2000000000000004e146 < z < 7.5e210

    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 0 99.9%

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

      \[\leadsto \color{blue}{-6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
    7. Step-by-step derivation
      1. associate-*r*99.9%

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

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

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

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

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

        \[\leadsto -6 \cdot \color{blue}{\left(z \cdot y\right)} \]
    11. Simplified65.4%

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

    if -2.1999999999999999e54 < z < -4.3e5 or 7.5e210 < z

    1. Initial program 99.8%

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

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

      \[\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.7%

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

      \[\leadsto \color{blue}{-6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
    7. Step-by-step derivation
      1. associate-*r*98.6%

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

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

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

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

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

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

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

    if -4.3e5 < z < -6.5e-29 or -3.8000000000000001e-116 < z < -5.4e-207

    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 60.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -6.5e-29 < z < -3.8000000000000001e-116 or -5.4e-207 < 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 x around 0 99.5%

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

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

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

        \[\leadsto \color{blue}{y \cdot 4} \]
    9. Simplified54.7%

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

    if 0.650000000000000022 < z < 8.19999999999999956e64

    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 z around 0 99.2%

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

      \[\leadsto \color{blue}{-6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
    7. Step-by-step derivation
      1. associate-*r*92.8%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot \left(-6 \cdot z\right)} \]
    11. Simplified68.4%

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

    if 8.19999999999999956e64 < z < 6.2000000000000004e146

    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 65.1%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.2 \cdot 10^{+54}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -430000:\\ \;\;\;\;z \cdot \left(x \cdot 6\right)\\ \mathbf{elif}\;z \leq -6.5 \cdot 10^{-29}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -3.8 \cdot 10^{-116}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -5.4 \cdot 10^{-207}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.65:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 8.2 \cdot 10^{+64}:\\ \;\;\;\;y \cdot \left(z \cdot -6\right)\\ \mathbf{elif}\;z \leq 6.2 \cdot 10^{+146}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq 7.5 \cdot 10^{+210}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(x \cdot 6\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 73.6% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\ t_1 := -6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{if}\;z \leq -3600000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -6.2 \cdot 10^{-119}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -3.7 \cdot 10^{-208}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 4 \cdot 10^{+14}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* 6.0 (* y (- 0.6666666666666666 z))))
        (t_1 (* -6.0 (* (- y x) z))))
   (if (<= z -3600000.0)
     t_1
     (if (<= z -6.2e-119)
       t_0
       (if (<= z -3.7e-208) (* x -3.0) (if (<= z 4e+14) t_0 t_1))))))
double code(double x, double y, double z) {
	double t_0 = 6.0 * (y * (0.6666666666666666 - z));
	double t_1 = -6.0 * ((y - x) * z);
	double tmp;
	if (z <= -3600000.0) {
		tmp = t_1;
	} else if (z <= -6.2e-119) {
		tmp = t_0;
	} else if (z <= -3.7e-208) {
		tmp = x * -3.0;
	} else if (z <= 4e+14) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	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) :: t_1
    real(8) :: tmp
    t_0 = 6.0d0 * (y * (0.6666666666666666d0 - z))
    t_1 = (-6.0d0) * ((y - x) * z)
    if (z <= (-3600000.0d0)) then
        tmp = t_1
    else if (z <= (-6.2d-119)) then
        tmp = t_0
    else if (z <= (-3.7d-208)) then
        tmp = x * (-3.0d0)
    else if (z <= 4d+14) then
        tmp = t_0
    else
        tmp = t_1
    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 t_1 = -6.0 * ((y - x) * z);
	double tmp;
	if (z <= -3600000.0) {
		tmp = t_1;
	} else if (z <= -6.2e-119) {
		tmp = t_0;
	} else if (z <= -3.7e-208) {
		tmp = x * -3.0;
	} else if (z <= 4e+14) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 6.0 * (y * (0.6666666666666666 - z))
	t_1 = -6.0 * ((y - x) * z)
	tmp = 0
	if z <= -3600000.0:
		tmp = t_1
	elif z <= -6.2e-119:
		tmp = t_0
	elif z <= -3.7e-208:
		tmp = x * -3.0
	elif z <= 4e+14:
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(6.0 * Float64(y * Float64(0.6666666666666666 - z)))
	t_1 = Float64(-6.0 * Float64(Float64(y - x) * z))
	tmp = 0.0
	if (z <= -3600000.0)
		tmp = t_1;
	elseif (z <= -6.2e-119)
		tmp = t_0;
	elseif (z <= -3.7e-208)
		tmp = Float64(x * -3.0);
	elseif (z <= 4e+14)
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 6.0 * (y * (0.6666666666666666 - z));
	t_1 = -6.0 * ((y - x) * z);
	tmp = 0.0;
	if (z <= -3600000.0)
		tmp = t_1;
	elseif (z <= -6.2e-119)
		tmp = t_0;
	elseif (z <= -3.7e-208)
		tmp = x * -3.0;
	elseif (z <= 4e+14)
		tmp = t_0;
	else
		tmp = t_1;
	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]}, Block[{t$95$1 = N[(-6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3600000.0], t$95$1, If[LessEqual[z, -6.2e-119], t$95$0, If[LessEqual[z, -3.7e-208], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 4e+14], t$95$0, t$95$1]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\
t_1 := -6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{if}\;z \leq -3600000:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq -6.2 \cdot 10^{-119}:\\
\;\;\;\;t\_0\\

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

\mathbf{elif}\;z \leq 4 \cdot 10^{+14}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -3.6e6 or 4e14 < 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 0 99.7%

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

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

    if -3.6e6 < z < -6.19999999999999956e-119 or -3.7000000000000002e-208 < z < 4e14

    1. Initial program 98.7%

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

        \[\leadsto x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\color{blue}{0.6666666666666666} - z\right) \]
    3. Simplified98.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 0 99.5%

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

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

    if -6.19999999999999956e-119 < z < -3.7000000000000002e-208

    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 62.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3600000:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{elif}\;z \leq -6.2 \cdot 10^{-119}:\\ \;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\ \mathbf{elif}\;z \leq -3.7 \cdot 10^{-208}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 4 \cdot 10^{+14}:\\ \;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 73.4% accurate, 0.8× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;y \cdot 4\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -0.00279999999999999997 or 0.640000000000000013 < 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 0 99.7%

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

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

    if -0.00279999999999999997 < z < 0.640000000000000013

    1. Initial program 98.8%

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

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

      \[\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 0 99.5%

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

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

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

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

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

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

Alternative 8: 75.6% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.9 \cdot 10^{-28} \lor \neg \left(y \leq 1.6 \cdot 10^{-22}\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 -1.9e-28) (not (<= y 1.6e-22)))
   (* 6.0 (* y (- 0.6666666666666666 z)))
   (* x (+ -3.0 (* z 6.0)))))
double code(double x, double y, double z) {
	double tmp;
	if ((y <= -1.9e-28) || !(y <= 1.6e-22)) {
		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 <= (-1.9d-28)) .or. (.not. (y <= 1.6d-22))) 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 <= -1.9e-28) || !(y <= 1.6e-22)) {
		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 <= -1.9e-28) or not (y <= 1.6e-22):
		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 <= -1.9e-28) || !(y <= 1.6e-22))
		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 <= -1.9e-28) || ~((y <= 1.6e-22)))
		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, -1.9e-28], N[Not[LessEqual[y, 1.6e-22]], $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 -1.9 \cdot 10^{-28} \lor \neg \left(y \leq 1.6 \cdot 10^{-22}\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 < -1.90000000000000005e-28 or 1.59999999999999994e-22 < y

    1. Initial program 99.1%

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

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

      \[\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 0 94.1%

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

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

    if -1.90000000000000005e-28 < y < 1.59999999999999994e-22

    1. Initial program 99.6%

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

        \[\leadsto x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\color{blue}{0.6666666666666666} - z\right) \]
    3. Simplified99.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 x around inf 85.4%

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

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

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

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

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

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

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

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

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

      \[\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 -1.9 \cdot 10^{-28} \lor \neg \left(y \leq 1.6 \cdot 10^{-22}\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: 75.6% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -4.8 \cdot 10^{-24} \lor \neg \left(y \leq 4 \cdot 10^{-30}\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 -4.8e-24) (not (<= y 4e-30)))
   (* y (+ 4.0 (* z -6.0)))
   (* x (+ -3.0 (* z 6.0)))))
double code(double x, double y, double z) {
	double tmp;
	if ((y <= -4.8e-24) || !(y <= 4e-30)) {
		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 <= (-4.8d-24)) .or. (.not. (y <= 4d-30))) 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 <= -4.8e-24) || !(y <= 4e-30)) {
		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 <= -4.8e-24) or not (y <= 4e-30):
		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 <= -4.8e-24) || !(y <= 4e-30))
		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 <= -4.8e-24) || ~((y <= 4e-30)))
		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, -4.8e-24], N[Not[LessEqual[y, 4e-30]], $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 -4.8 \cdot 10^{-24} \lor \neg \left(y \leq 4 \cdot 10^{-30}\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 < -4.7999999999999996e-24 or 4e-30 < y

    1. Initial program 99.1%

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

        \[\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. Taylor expanded in y around inf 79.6%

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

    if -4.7999999999999996e-24 < y < 4e-30

    1. Initial program 99.6%

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

        \[\leadsto x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\color{blue}{0.6666666666666666} - z\right) \]
    3. Simplified99.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 x around inf 85.4%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4.8 \cdot 10^{-24} \lor \neg \left(y \leq 4 \cdot 10^{-30}\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 10: 97.8% accurate, 0.8× speedup?

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

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

\mathbf{elif}\;z \leq 0.52:\\
\;\;\;\;x + \left(y - x\right) \cdot 4\\

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


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

    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 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. Taylor expanded in z around inf 98.3%

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

    if -0.599999999999999978 < z < 0.52000000000000002

    1. Initial program 98.8%

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

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

      \[\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 98.5%

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

    if 0.52000000000000002 < 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 0 99.6%

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

      \[\leadsto \color{blue}{-6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
    7. Step-by-step derivation
      1. associate-*r*98.7%

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

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

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

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

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

Alternative 11: 97.8% accurate, 0.8× speedup?

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

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

\mathbf{elif}\;z \leq 0.65:\\
\;\;\;\;x \cdot -3 + y \cdot 4\\

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


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

    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 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. Taylor expanded in z around inf 98.3%

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

    if -0.57999999999999996 < z < 0.650000000000000022

    1. Initial program 98.8%

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

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

      \[\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 0 99.5%

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

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

    if 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 0 99.6%

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

      \[\leadsto \color{blue}{-6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
    7. Step-by-step derivation
      1. associate-*r*98.7%

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

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

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

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

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

Alternative 12: 51.0% accurate, 0.9× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;y \cdot 4\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -0.680000000000000049 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 0 99.7%

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

      \[\leadsto \color{blue}{-6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
    7. Step-by-step derivation
      1. associate-*r*98.5%

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

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

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

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

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

        \[\leadsto -6 \cdot \color{blue}{\left(z \cdot y\right)} \]
    11. Simplified52.4%

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

    if -0.680000000000000049 < z < 0.650000000000000022

    1. Initial program 98.8%

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

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

      \[\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 0 99.5%

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

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

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

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

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

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

Alternative 13: 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.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 z around 0 99.7%

    \[\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.7%

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

Alternative 14: 38.9% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.5 \cdot 10^{-15} \lor \neg \left(x \leq 2.8 \cdot 10^{-78}\right):\\
\;\;\;\;x \cdot -3\\

\mathbf{else}:\\
\;\;\;\;y \cdot 4\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -6.49999999999999991e-15 or 2.80000000000000024e-78 < x

    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 72.6%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    10. Simplified35.8%

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

    if -6.49999999999999991e-15 < x < 2.80000000000000024e-78

    1. Initial program 98.8%

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

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

      \[\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 0 99.5%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -6.5 \cdot 10^{-15} \lor \neg \left(x \leq 2.8 \cdot 10^{-78}\right):\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;y \cdot 4\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 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.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. Final simplification99.3%

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

Alternative 16: 26.5% 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.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 50.2%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{x \cdot -3} \]
  11. Final simplification23.3%

    \[\leadsto x \cdot -3 \]
  12. Add Preprocessing

Reproduce

?
herbie shell --seed 2024075 
(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))))