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

Percentage Accurate: 99.5% → 99.6%
Time: 10.1s
Alternatives: 15
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 15 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.6% accurate, 0.9× speedup?

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

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

    \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
  2. Taylor expanded in z around 0 99.8%

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

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

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

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

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

      \[\leadsto 4 \cdot \left(y - x\right) + \left(\left(\left(z \cdot 6\right) \cdot x + \color{blue}{\left(-6 \cdot \left(y \cdot z\right)\right)}\right) + x\right) \]
    5. associate-*l*98.3%

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

      \[\leadsto 4 \cdot \left(y - x\right) + \left(\left(\left(z \cdot 6\right) \cdot x + \left(-\color{blue}{z \cdot \left(6 \cdot y\right)}\right)\right) + x\right) \]
    7. associate-*r*97.9%

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

      \[\leadsto 4 \cdot \left(y - x\right) + \left(\left(\left(z \cdot 6\right) \cdot x + \color{blue}{\left(z \cdot 6\right) \cdot \left(-y\right)}\right) + x\right) \]
    9. neg-mul-197.9%

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

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

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

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

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

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

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

Alternative 2: 49.6% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 6 \cdot \left(x \cdot z\right)\\ t_1 := -6 \cdot \left(y \cdot z\right)\\ \mathbf{if}\;z \leq -4.8 \cdot 10^{+205}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.15 \cdot 10^{+148}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -2.65 \cdot 10^{+20}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 5.4 \cdot 10^{-71}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.15 \cdot 10^{-24}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 0.65:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* 6.0 (* x z))) (t_1 (* -6.0 (* y z))))
   (if (<= z -4.8e+205)
     t_0
     (if (<= z -1.15e+148)
       t_1
       (if (<= z -2.65e+20)
         t_0
         (if (<= z 5.4e-71)
           (* x -3.0)
           (if (<= z 1.15e-24) (* 4.0 y) (if (<= z 0.65) (* x -3.0) t_1))))))))
double code(double x, double y, double z) {
	double t_0 = 6.0 * (x * z);
	double t_1 = -6.0 * (y * z);
	double tmp;
	if (z <= -4.8e+205) {
		tmp = t_0;
	} else if (z <= -1.15e+148) {
		tmp = t_1;
	} else if (z <= -2.65e+20) {
		tmp = t_0;
	} else if (z <= 5.4e-71) {
		tmp = x * -3.0;
	} else if (z <= 1.15e-24) {
		tmp = 4.0 * y;
	} else if (z <= 0.65) {
		tmp = x * -3.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 * (x * z)
    t_1 = (-6.0d0) * (y * z)
    if (z <= (-4.8d+205)) then
        tmp = t_0
    else if (z <= (-1.15d+148)) then
        tmp = t_1
    else if (z <= (-2.65d+20)) then
        tmp = t_0
    else if (z <= 5.4d-71) then
        tmp = x * (-3.0d0)
    else if (z <= 1.15d-24) then
        tmp = 4.0d0 * y
    else if (z <= 0.65d0) then
        tmp = x * (-3.0d0)
    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 * (x * z);
	double t_1 = -6.0 * (y * z);
	double tmp;
	if (z <= -4.8e+205) {
		tmp = t_0;
	} else if (z <= -1.15e+148) {
		tmp = t_1;
	} else if (z <= -2.65e+20) {
		tmp = t_0;
	} else if (z <= 5.4e-71) {
		tmp = x * -3.0;
	} else if (z <= 1.15e-24) {
		tmp = 4.0 * y;
	} else if (z <= 0.65) {
		tmp = x * -3.0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 6.0 * (x * z)
	t_1 = -6.0 * (y * z)
	tmp = 0
	if z <= -4.8e+205:
		tmp = t_0
	elif z <= -1.15e+148:
		tmp = t_1
	elif z <= -2.65e+20:
		tmp = t_0
	elif z <= 5.4e-71:
		tmp = x * -3.0
	elif z <= 1.15e-24:
		tmp = 4.0 * y
	elif z <= 0.65:
		tmp = x * -3.0
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(6.0 * Float64(x * z))
	t_1 = Float64(-6.0 * Float64(y * z))
	tmp = 0.0
	if (z <= -4.8e+205)
		tmp = t_0;
	elseif (z <= -1.15e+148)
		tmp = t_1;
	elseif (z <= -2.65e+20)
		tmp = t_0;
	elseif (z <= 5.4e-71)
		tmp = Float64(x * -3.0);
	elseif (z <= 1.15e-24)
		tmp = Float64(4.0 * y);
	elseif (z <= 0.65)
		tmp = Float64(x * -3.0);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 6.0 * (x * z);
	t_1 = -6.0 * (y * z);
	tmp = 0.0;
	if (z <= -4.8e+205)
		tmp = t_0;
	elseif (z <= -1.15e+148)
		tmp = t_1;
	elseif (z <= -2.65e+20)
		tmp = t_0;
	elseif (z <= 5.4e-71)
		tmp = x * -3.0;
	elseif (z <= 1.15e-24)
		tmp = 4.0 * y;
	elseif (z <= 0.65)
		tmp = x * -3.0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.8e+205], t$95$0, If[LessEqual[z, -1.15e+148], t$95$1, If[LessEqual[z, -2.65e+20], t$95$0, If[LessEqual[z, 5.4e-71], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 1.15e-24], N[(4.0 * y), $MachinePrecision], If[LessEqual[z, 0.65], N[(x * -3.0), $MachinePrecision], t$95$1]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -1.15 \cdot 10^{+148}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq -2.65 \cdot 10^{+20}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;z \leq 1.15 \cdot 10^{-24}:\\
\;\;\;\;4 \cdot y\\

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

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -4.79999999999999972e205 or -1.15e148 < z < -2.65e20

    1. Initial program 99.9%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Taylor expanded in x around inf 67.9%

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

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

    if -4.79999999999999972e205 < z < -1.15e148 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. Taylor expanded in z around 0 99.7%

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

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

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

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

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

    if -2.65e20 < z < 5.4000000000000003e-71 or 1.1500000000000001e-24 < z < 0.650000000000000022

    1. Initial program 99.4%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Taylor expanded in x around inf 61.6%

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(1 + \left(4 \cdot -1 + -6 \cdot \color{blue}{\left(z \cdot -1\right)}\right)\right) \]
      8. associate-*l*61.6%

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

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

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

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

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

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

        \[\leadsto x \cdot \left(\color{blue}{-1 \cdot 3} + -1 \cdot \left(-6 \cdot z\right)\right) \]
      15. distribute-lft-in61.6%

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

        \[\leadsto x \cdot \left(-1 \cdot \color{blue}{\left(-6 \cdot z + 3\right)}\right) \]
      17. distribute-lft-in61.6%

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    7. Simplified60.4%

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

    if 5.4000000000000003e-71 < z < 1.1500000000000001e-24

    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. +-commutative99.7%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{6 \cdot \left(-z\right) + 6 \cdot \frac{2}{3}}, x\right) \]
      7. neg-mul-1100.0%

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

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

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{z \cdot \left(6 \cdot -1\right)} + 6 \cdot \frac{2}{3}, x\right) \]
      10. fma-def100.0%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\mathsf{fma}\left(z, 6 \cdot -1, 6 \cdot \frac{2}{3}\right)}, x\right) \]
      11. metadata-eval100.0%

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

        \[\leadsto \mathsf{fma}\left(y - x, \mathsf{fma}\left(z, -6, 6 \cdot \color{blue}{0.6666666666666666}\right), x\right) \]
      13. metadata-eval100.0%

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

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

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

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

        \[\leadsto \color{blue}{y \cdot 4} \]
    7. Simplified78.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4.8 \cdot 10^{+205}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -1.15 \cdot 10^{+148}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -2.65 \cdot 10^{+20}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq 5.4 \cdot 10^{-71}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.15 \cdot 10^{-24}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 0.65:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \end{array} \]

Alternative 3: 49.6% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(z \cdot 6\right)\\ t_1 := -6 \cdot \left(y \cdot z\right)\\ \mathbf{if}\;z \leq -9.2 \cdot 10^{+204}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.65 \cdot 10^{+146}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -2.65 \cdot 10^{+20}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 2.5 \cdot 10^{-70}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 2.4 \cdot 10^{-24}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 0.65:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* x (* z 6.0))) (t_1 (* -6.0 (* y z))))
   (if (<= z -9.2e+204)
     t_0
     (if (<= z -1.65e+146)
       t_1
       (if (<= z -2.65e+20)
         t_0
         (if (<= z 2.5e-70)
           (* x -3.0)
           (if (<= z 2.4e-24) (* 4.0 y) (if (<= z 0.65) (* x -3.0) t_1))))))))
double code(double x, double y, double z) {
	double t_0 = x * (z * 6.0);
	double t_1 = -6.0 * (y * z);
	double tmp;
	if (z <= -9.2e+204) {
		tmp = t_0;
	} else if (z <= -1.65e+146) {
		tmp = t_1;
	} else if (z <= -2.65e+20) {
		tmp = t_0;
	} else if (z <= 2.5e-70) {
		tmp = x * -3.0;
	} else if (z <= 2.4e-24) {
		tmp = 4.0 * y;
	} else if (z <= 0.65) {
		tmp = x * -3.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 = x * (z * 6.0d0)
    t_1 = (-6.0d0) * (y * z)
    if (z <= (-9.2d+204)) then
        tmp = t_0
    else if (z <= (-1.65d+146)) then
        tmp = t_1
    else if (z <= (-2.65d+20)) then
        tmp = t_0
    else if (z <= 2.5d-70) then
        tmp = x * (-3.0d0)
    else if (z <= 2.4d-24) then
        tmp = 4.0d0 * y
    else if (z <= 0.65d0) then
        tmp = x * (-3.0d0)
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = x * (z * 6.0);
	double t_1 = -6.0 * (y * z);
	double tmp;
	if (z <= -9.2e+204) {
		tmp = t_0;
	} else if (z <= -1.65e+146) {
		tmp = t_1;
	} else if (z <= -2.65e+20) {
		tmp = t_0;
	} else if (z <= 2.5e-70) {
		tmp = x * -3.0;
	} else if (z <= 2.4e-24) {
		tmp = 4.0 * y;
	} else if (z <= 0.65) {
		tmp = x * -3.0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x * (z * 6.0)
	t_1 = -6.0 * (y * z)
	tmp = 0
	if z <= -9.2e+204:
		tmp = t_0
	elif z <= -1.65e+146:
		tmp = t_1
	elif z <= -2.65e+20:
		tmp = t_0
	elif z <= 2.5e-70:
		tmp = x * -3.0
	elif z <= 2.4e-24:
		tmp = 4.0 * y
	elif z <= 0.65:
		tmp = x * -3.0
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(x * Float64(z * 6.0))
	t_1 = Float64(-6.0 * Float64(y * z))
	tmp = 0.0
	if (z <= -9.2e+204)
		tmp = t_0;
	elseif (z <= -1.65e+146)
		tmp = t_1;
	elseif (z <= -2.65e+20)
		tmp = t_0;
	elseif (z <= 2.5e-70)
		tmp = Float64(x * -3.0);
	elseif (z <= 2.4e-24)
		tmp = Float64(4.0 * y);
	elseif (z <= 0.65)
		tmp = Float64(x * -3.0);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x * (z * 6.0);
	t_1 = -6.0 * (y * z);
	tmp = 0.0;
	if (z <= -9.2e+204)
		tmp = t_0;
	elseif (z <= -1.65e+146)
		tmp = t_1;
	elseif (z <= -2.65e+20)
		tmp = t_0;
	elseif (z <= 2.5e-70)
		tmp = x * -3.0;
	elseif (z <= 2.4e-24)
		tmp = 4.0 * y;
	elseif (z <= 0.65)
		tmp = x * -3.0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(z * 6.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -9.2e+204], t$95$0, If[LessEqual[z, -1.65e+146], t$95$1, If[LessEqual[z, -2.65e+20], t$95$0, If[LessEqual[z, 2.5e-70], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 2.4e-24], N[(4.0 * y), $MachinePrecision], If[LessEqual[z, 0.65], N[(x * -3.0), $MachinePrecision], t$95$1]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -1.65 \cdot 10^{+146}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq -2.65 \cdot 10^{+20}:\\
\;\;\;\;t_0\\

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

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

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

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -9.19999999999999962e204 or -1.65000000000000008e146 < z < -2.65e20

    1. Initial program 99.9%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Taylor expanded in x around inf 67.9%

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(1 + \left(4 \cdot -1 + -6 \cdot \color{blue}{\left(z \cdot -1\right)}\right)\right) \]
      8. associate-*l*67.9%

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

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

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

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

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

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

        \[\leadsto x \cdot \left(\color{blue}{-1 \cdot 3} + -1 \cdot \left(-6 \cdot z\right)\right) \]
      15. distribute-lft-in67.9%

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

        \[\leadsto x \cdot \left(-1 \cdot \color{blue}{\left(-6 \cdot z + 3\right)}\right) \]
      17. distribute-lft-in67.9%

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

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

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

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

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

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

    if -9.19999999999999962e204 < z < -1.65000000000000008e146 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. Taylor expanded in z around 0 99.7%

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

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

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

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

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

    if -2.65e20 < z < 2.4999999999999999e-70 or 2.3999999999999998e-24 < z < 0.650000000000000022

    1. Initial program 99.4%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Taylor expanded in x around inf 61.6%

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(1 + \left(4 \cdot -1 + -6 \cdot \color{blue}{\left(z \cdot -1\right)}\right)\right) \]
      8. associate-*l*61.6%

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

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

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

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

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

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

        \[\leadsto x \cdot \left(\color{blue}{-1 \cdot 3} + -1 \cdot \left(-6 \cdot z\right)\right) \]
      15. distribute-lft-in61.6%

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

        \[\leadsto x \cdot \left(-1 \cdot \color{blue}{\left(-6 \cdot z + 3\right)}\right) \]
      17. distribute-lft-in61.6%

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    7. Simplified60.4%

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

    if 2.4999999999999999e-70 < z < 2.3999999999999998e-24

    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. +-commutative99.7%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{6 \cdot \left(-z\right) + 6 \cdot \frac{2}{3}}, x\right) \]
      7. neg-mul-1100.0%

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

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

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{z \cdot \left(6 \cdot -1\right)} + 6 \cdot \frac{2}{3}, x\right) \]
      10. fma-def100.0%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\mathsf{fma}\left(z, 6 \cdot -1, 6 \cdot \frac{2}{3}\right)}, x\right) \]
      11. metadata-eval100.0%

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

        \[\leadsto \mathsf{fma}\left(y - x, \mathsf{fma}\left(z, -6, 6 \cdot \color{blue}{0.6666666666666666}\right), x\right) \]
      13. metadata-eval100.0%

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

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

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

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

        \[\leadsto \color{blue}{y \cdot 4} \]
    7. Simplified78.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -9.2 \cdot 10^{+204}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq -1.65 \cdot 10^{+146}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -2.65 \cdot 10^{+20}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq 2.5 \cdot 10^{-70}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 2.4 \cdot 10^{-24}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 0.65:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \end{array} \]

Alternative 4: 49.6% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(z \cdot 6\right)\\ \mathbf{if}\;z \leq -1.2 \cdot 10^{+205}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -3.9 \cdot 10^{+149}:\\ \;\;\;\;z \cdot \left(y \cdot -6\right)\\ \mathbf{elif}\;z \leq -2.65 \cdot 10^{+20}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 2.15 \cdot 10^{-71}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 5.2 \cdot 10^{-24}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 0.62:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* x (* z 6.0))))
   (if (<= z -1.2e+205)
     t_0
     (if (<= z -3.9e+149)
       (* z (* y -6.0))
       (if (<= z -2.65e+20)
         t_0
         (if (<= z 2.15e-71)
           (* x -3.0)
           (if (<= z 5.2e-24)
             (* 4.0 y)
             (if (<= z 0.62) (* x -3.0) (* -6.0 (* y z))))))))))
double code(double x, double y, double z) {
	double t_0 = x * (z * 6.0);
	double tmp;
	if (z <= -1.2e+205) {
		tmp = t_0;
	} else if (z <= -3.9e+149) {
		tmp = z * (y * -6.0);
	} else if (z <= -2.65e+20) {
		tmp = t_0;
	} else if (z <= 2.15e-71) {
		tmp = x * -3.0;
	} else if (z <= 5.2e-24) {
		tmp = 4.0 * y;
	} else if (z <= 0.62) {
		tmp = x * -3.0;
	} else {
		tmp = -6.0 * (y * z);
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = x * (z * 6.0d0)
    if (z <= (-1.2d+205)) then
        tmp = t_0
    else if (z <= (-3.9d+149)) then
        tmp = z * (y * (-6.0d0))
    else if (z <= (-2.65d+20)) then
        tmp = t_0
    else if (z <= 2.15d-71) then
        tmp = x * (-3.0d0)
    else if (z <= 5.2d-24) then
        tmp = 4.0d0 * y
    else if (z <= 0.62d0) then
        tmp = x * (-3.0d0)
    else
        tmp = (-6.0d0) * (y * z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = x * (z * 6.0);
	double tmp;
	if (z <= -1.2e+205) {
		tmp = t_0;
	} else if (z <= -3.9e+149) {
		tmp = z * (y * -6.0);
	} else if (z <= -2.65e+20) {
		tmp = t_0;
	} else if (z <= 2.15e-71) {
		tmp = x * -3.0;
	} else if (z <= 5.2e-24) {
		tmp = 4.0 * y;
	} else if (z <= 0.62) {
		tmp = x * -3.0;
	} else {
		tmp = -6.0 * (y * z);
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x * (z * 6.0)
	tmp = 0
	if z <= -1.2e+205:
		tmp = t_0
	elif z <= -3.9e+149:
		tmp = z * (y * -6.0)
	elif z <= -2.65e+20:
		tmp = t_0
	elif z <= 2.15e-71:
		tmp = x * -3.0
	elif z <= 5.2e-24:
		tmp = 4.0 * y
	elif z <= 0.62:
		tmp = x * -3.0
	else:
		tmp = -6.0 * (y * z)
	return tmp
function code(x, y, z)
	t_0 = Float64(x * Float64(z * 6.0))
	tmp = 0.0
	if (z <= -1.2e+205)
		tmp = t_0;
	elseif (z <= -3.9e+149)
		tmp = Float64(z * Float64(y * -6.0));
	elseif (z <= -2.65e+20)
		tmp = t_0;
	elseif (z <= 2.15e-71)
		tmp = Float64(x * -3.0);
	elseif (z <= 5.2e-24)
		tmp = Float64(4.0 * y);
	elseif (z <= 0.62)
		tmp = Float64(x * -3.0);
	else
		tmp = Float64(-6.0 * Float64(y * z));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x * (z * 6.0);
	tmp = 0.0;
	if (z <= -1.2e+205)
		tmp = t_0;
	elseif (z <= -3.9e+149)
		tmp = z * (y * -6.0);
	elseif (z <= -2.65e+20)
		tmp = t_0;
	elseif (z <= 2.15e-71)
		tmp = x * -3.0;
	elseif (z <= 5.2e-24)
		tmp = 4.0 * y;
	elseif (z <= 0.62)
		tmp = x * -3.0;
	else
		tmp = -6.0 * (y * z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(z * 6.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.2e+205], t$95$0, If[LessEqual[z, -3.9e+149], N[(z * N[(y * -6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -2.65e+20], t$95$0, If[LessEqual[z, 2.15e-71], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 5.2e-24], N[(4.0 * y), $MachinePrecision], If[LessEqual[z, 0.62], N[(x * -3.0), $MachinePrecision], N[(-6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x \cdot \left(z \cdot 6\right)\\
\mathbf{if}\;z \leq -1.2 \cdot 10^{+205}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;z \leq -2.65 \cdot 10^{+20}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;z \leq 5.2 \cdot 10^{-24}:\\
\;\;\;\;4 \cdot y\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if z < -1.19999999999999993e205 or -3.8999999999999999e149 < z < -2.65e20

    1. Initial program 99.9%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Taylor expanded in x around inf 67.9%

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(1 + \left(4 \cdot -1 + -6 \cdot \color{blue}{\left(z \cdot -1\right)}\right)\right) \]
      8. associate-*l*67.9%

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

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

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

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

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

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

        \[\leadsto x \cdot \left(\color{blue}{-1 \cdot 3} + -1 \cdot \left(-6 \cdot z\right)\right) \]
      15. distribute-lft-in67.9%

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

        \[\leadsto x \cdot \left(-1 \cdot \color{blue}{\left(-6 \cdot z + 3\right)}\right) \]
      17. distribute-lft-in67.9%

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

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

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

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

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

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

    if -1.19999999999999993e205 < z < -3.8999999999999999e149

    1. Initial program 100.0%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Taylor expanded in z around 0 99.8%

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

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

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

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

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

    if -2.65e20 < z < 2.1499999999999998e-71 or 5.2e-24 < z < 0.619999999999999996

    1. Initial program 99.4%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Taylor expanded in x around inf 61.6%

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(1 + \left(4 \cdot -1 + -6 \cdot \color{blue}{\left(z \cdot -1\right)}\right)\right) \]
      8. associate-*l*61.6%

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

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

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

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

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

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

        \[\leadsto x \cdot \left(\color{blue}{-1 \cdot 3} + -1 \cdot \left(-6 \cdot z\right)\right) \]
      15. distribute-lft-in61.6%

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

        \[\leadsto x \cdot \left(-1 \cdot \color{blue}{\left(-6 \cdot z + 3\right)}\right) \]
      17. distribute-lft-in61.6%

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    7. Simplified60.4%

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

    if 2.1499999999999998e-71 < z < 5.2e-24

    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. +-commutative99.7%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{6 \cdot \left(-z\right) + 6 \cdot \frac{2}{3}}, x\right) \]
      7. neg-mul-1100.0%

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

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

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{z \cdot \left(6 \cdot -1\right)} + 6 \cdot \frac{2}{3}, x\right) \]
      10. fma-def100.0%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\mathsf{fma}\left(z, 6 \cdot -1, 6 \cdot \frac{2}{3}\right)}, x\right) \]
      11. metadata-eval100.0%

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

        \[\leadsto \mathsf{fma}\left(y - x, \mathsf{fma}\left(z, -6, 6 \cdot \color{blue}{0.6666666666666666}\right), x\right) \]
      13. metadata-eval100.0%

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

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

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

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

        \[\leadsto \color{blue}{y \cdot 4} \]
    7. Simplified78.5%

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

    if 0.619999999999999996 < z

    1. Initial program 99.6%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Taylor expanded in z around 0 99.7%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.2 \cdot 10^{+205}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq -3.9 \cdot 10^{+149}:\\ \;\;\;\;z \cdot \left(y \cdot -6\right)\\ \mathbf{elif}\;z \leq -2.65 \cdot 10^{+20}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq 2.15 \cdot 10^{-71}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 5.2 \cdot 10^{-24}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 0.62:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \end{array} \]

Alternative 5: 49.6% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(z \cdot 6\right)\\ \mathbf{if}\;z \leq -2.7 \cdot 10^{+205}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.6 \cdot 10^{+146}:\\ \;\;\;\;z \cdot \left(y \cdot -6\right)\\ \mathbf{elif}\;z \leq -2.65 \cdot 10^{+20}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1.3 \cdot 10^{-70}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 6.6 \cdot 10^{-25}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 0.56:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(z \cdot -6\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* x (* z 6.0))))
   (if (<= z -2.7e+205)
     t_0
     (if (<= z -1.6e+146)
       (* z (* y -6.0))
       (if (<= z -2.65e+20)
         t_0
         (if (<= z 1.3e-70)
           (* x -3.0)
           (if (<= z 6.6e-25)
             (* 4.0 y)
             (if (<= z 0.56) (* x -3.0) (* y (* z -6.0))))))))))
double code(double x, double y, double z) {
	double t_0 = x * (z * 6.0);
	double tmp;
	if (z <= -2.7e+205) {
		tmp = t_0;
	} else if (z <= -1.6e+146) {
		tmp = z * (y * -6.0);
	} else if (z <= -2.65e+20) {
		tmp = t_0;
	} else if (z <= 1.3e-70) {
		tmp = x * -3.0;
	} else if (z <= 6.6e-25) {
		tmp = 4.0 * y;
	} else if (z <= 0.56) {
		tmp = x * -3.0;
	} else {
		tmp = y * (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) :: t_0
    real(8) :: tmp
    t_0 = x * (z * 6.0d0)
    if (z <= (-2.7d+205)) then
        tmp = t_0
    else if (z <= (-1.6d+146)) then
        tmp = z * (y * (-6.0d0))
    else if (z <= (-2.65d+20)) then
        tmp = t_0
    else if (z <= 1.3d-70) then
        tmp = x * (-3.0d0)
    else if (z <= 6.6d-25) then
        tmp = 4.0d0 * y
    else if (z <= 0.56d0) then
        tmp = x * (-3.0d0)
    else
        tmp = y * (z * (-6.0d0))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = x * (z * 6.0);
	double tmp;
	if (z <= -2.7e+205) {
		tmp = t_0;
	} else if (z <= -1.6e+146) {
		tmp = z * (y * -6.0);
	} else if (z <= -2.65e+20) {
		tmp = t_0;
	} else if (z <= 1.3e-70) {
		tmp = x * -3.0;
	} else if (z <= 6.6e-25) {
		tmp = 4.0 * y;
	} else if (z <= 0.56) {
		tmp = x * -3.0;
	} else {
		tmp = y * (z * -6.0);
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x * (z * 6.0)
	tmp = 0
	if z <= -2.7e+205:
		tmp = t_0
	elif z <= -1.6e+146:
		tmp = z * (y * -6.0)
	elif z <= -2.65e+20:
		tmp = t_0
	elif z <= 1.3e-70:
		tmp = x * -3.0
	elif z <= 6.6e-25:
		tmp = 4.0 * y
	elif z <= 0.56:
		tmp = x * -3.0
	else:
		tmp = y * (z * -6.0)
	return tmp
function code(x, y, z)
	t_0 = Float64(x * Float64(z * 6.0))
	tmp = 0.0
	if (z <= -2.7e+205)
		tmp = t_0;
	elseif (z <= -1.6e+146)
		tmp = Float64(z * Float64(y * -6.0));
	elseif (z <= -2.65e+20)
		tmp = t_0;
	elseif (z <= 1.3e-70)
		tmp = Float64(x * -3.0);
	elseif (z <= 6.6e-25)
		tmp = Float64(4.0 * y);
	elseif (z <= 0.56)
		tmp = Float64(x * -3.0);
	else
		tmp = Float64(y * Float64(z * -6.0));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x * (z * 6.0);
	tmp = 0.0;
	if (z <= -2.7e+205)
		tmp = t_0;
	elseif (z <= -1.6e+146)
		tmp = z * (y * -6.0);
	elseif (z <= -2.65e+20)
		tmp = t_0;
	elseif (z <= 1.3e-70)
		tmp = x * -3.0;
	elseif (z <= 6.6e-25)
		tmp = 4.0 * y;
	elseif (z <= 0.56)
		tmp = x * -3.0;
	else
		tmp = y * (z * -6.0);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(z * 6.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.7e+205], t$95$0, If[LessEqual[z, -1.6e+146], N[(z * N[(y * -6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -2.65e+20], t$95$0, If[LessEqual[z, 1.3e-70], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 6.6e-25], N[(4.0 * y), $MachinePrecision], If[LessEqual[z, 0.56], N[(x * -3.0), $MachinePrecision], N[(y * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x \cdot \left(z \cdot 6\right)\\
\mathbf{if}\;z \leq -2.7 \cdot 10^{+205}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;z \leq -2.65 \cdot 10^{+20}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;z \leq 6.6 \cdot 10^{-25}:\\
\;\;\;\;4 \cdot y\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if z < -2.70000000000000012e205 or -1.6e146 < z < -2.65e20

    1. Initial program 99.9%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Taylor expanded in x around inf 67.9%

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(1 + \left(4 \cdot -1 + -6 \cdot \color{blue}{\left(z \cdot -1\right)}\right)\right) \]
      8. associate-*l*67.9%

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

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

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

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

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

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

        \[\leadsto x \cdot \left(\color{blue}{-1 \cdot 3} + -1 \cdot \left(-6 \cdot z\right)\right) \]
      15. distribute-lft-in67.9%

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

        \[\leadsto x \cdot \left(-1 \cdot \color{blue}{\left(-6 \cdot z + 3\right)}\right) \]
      17. distribute-lft-in67.9%

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

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

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

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

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

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

    if -2.70000000000000012e205 < z < -1.6e146

    1. Initial program 100.0%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Taylor expanded in z around 0 99.8%

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

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

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

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

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

    if -2.65e20 < z < 1.30000000000000001e-70 or 6.5999999999999997e-25 < z < 0.56000000000000005

    1. Initial program 99.4%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Taylor expanded in x around inf 61.6%

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(1 + \left(4 \cdot -1 + -6 \cdot \color{blue}{\left(z \cdot -1\right)}\right)\right) \]
      8. associate-*l*61.6%

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

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

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

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

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

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

        \[\leadsto x \cdot \left(\color{blue}{-1 \cdot 3} + -1 \cdot \left(-6 \cdot z\right)\right) \]
      15. distribute-lft-in61.6%

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

        \[\leadsto x \cdot \left(-1 \cdot \color{blue}{\left(-6 \cdot z + 3\right)}\right) \]
      17. distribute-lft-in61.6%

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    7. Simplified60.4%

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

    if 1.30000000000000001e-70 < z < 6.5999999999999997e-25

    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. +-commutative99.7%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{6 \cdot \left(-z\right) + 6 \cdot \frac{2}{3}}, x\right) \]
      7. neg-mul-1100.0%

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

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

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{z \cdot \left(6 \cdot -1\right)} + 6 \cdot \frac{2}{3}, x\right) \]
      10. fma-def100.0%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\mathsf{fma}\left(z, 6 \cdot -1, 6 \cdot \frac{2}{3}\right)}, x\right) \]
      11. metadata-eval100.0%

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

        \[\leadsto \mathsf{fma}\left(y - x, \mathsf{fma}\left(z, -6, 6 \cdot \color{blue}{0.6666666666666666}\right), x\right) \]
      13. metadata-eval100.0%

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

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

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

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

        \[\leadsto \color{blue}{y \cdot 4} \]
    7. Simplified78.5%

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

    if 0.56000000000000005 < z

    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. +-commutative99.6%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{6 \cdot \left(-z\right) + 6 \cdot \frac{2}{3}}, x\right) \]
      7. neg-mul-199.7%

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

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

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{z \cdot \left(6 \cdot -1\right)} + 6 \cdot \frac{2}{3}, x\right) \]
      10. fma-def99.7%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.7 \cdot 10^{+205}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq -1.6 \cdot 10^{+146}:\\ \;\;\;\;z \cdot \left(y \cdot -6\right)\\ \mathbf{elif}\;z \leq -2.65 \cdot 10^{+20}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq 1.3 \cdot 10^{-70}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 6.6 \cdot 10^{-25}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 0.56:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(z \cdot -6\right)\\ \end{array} \]

Alternative 6: 72.5% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{if}\;z \leq -9 \cdot 10^{-5}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1.55 \cdot 10^{-71}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 2 \cdot 10^{-24}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* -6.0 (* (- y x) z))))
   (if (<= z -9e-5)
     t_0
     (if (<= z 1.55e-71)
       (* x -3.0)
       (if (<= z 2e-24) (* 4.0 y) (if (<= z 0.5) (* x -3.0) t_0))))))
double code(double x, double y, double z) {
	double t_0 = -6.0 * ((y - x) * z);
	double tmp;
	if (z <= -9e-5) {
		tmp = t_0;
	} else if (z <= 1.55e-71) {
		tmp = x * -3.0;
	} else if (z <= 2e-24) {
		tmp = 4.0 * y;
	} else if (z <= 0.5) {
		tmp = x * -3.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (-6.0d0) * ((y - x) * z)
    if (z <= (-9d-5)) then
        tmp = t_0
    else if (z <= 1.55d-71) then
        tmp = x * (-3.0d0)
    else if (z <= 2d-24) then
        tmp = 4.0d0 * y
    else if (z <= 0.5d0) then
        tmp = x * (-3.0d0)
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = -6.0 * ((y - x) * z);
	double tmp;
	if (z <= -9e-5) {
		tmp = t_0;
	} else if (z <= 1.55e-71) {
		tmp = x * -3.0;
	} else if (z <= 2e-24) {
		tmp = 4.0 * y;
	} else if (z <= 0.5) {
		tmp = x * -3.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = -6.0 * ((y - x) * z)
	tmp = 0
	if z <= -9e-5:
		tmp = t_0
	elif z <= 1.55e-71:
		tmp = x * -3.0
	elif z <= 2e-24:
		tmp = 4.0 * y
	elif z <= 0.5:
		tmp = x * -3.0
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(-6.0 * Float64(Float64(y - x) * z))
	tmp = 0.0
	if (z <= -9e-5)
		tmp = t_0;
	elseif (z <= 1.55e-71)
		tmp = Float64(x * -3.0);
	elseif (z <= 2e-24)
		tmp = Float64(4.0 * y);
	elseif (z <= 0.5)
		tmp = Float64(x * -3.0);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = -6.0 * ((y - x) * z);
	tmp = 0.0;
	if (z <= -9e-5)
		tmp = t_0;
	elseif (z <= 1.55e-71)
		tmp = x * -3.0;
	elseif (z <= 2e-24)
		tmp = 4.0 * y;
	elseif (z <= 0.5)
		tmp = x * -3.0;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(-6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -9e-5], t$95$0, If[LessEqual[z, 1.55e-71], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 2e-24], N[(4.0 * y), $MachinePrecision], If[LessEqual[z, 0.5], N[(x * -3.0), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := -6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{if}\;z \leq -9 \cdot 10^{-5}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;z \leq 2 \cdot 10^{-24}:\\
\;\;\;\;4 \cdot y\\

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

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -9.00000000000000057e-5 or 0.5 < z

    1. Initial program 99.8%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Taylor expanded in z around 0 99.7%

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

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

    if -9.00000000000000057e-5 < z < 1.55000000000000001e-71 or 1.99999999999999985e-24 < z < 0.5

    1. Initial program 99.3%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Taylor expanded in x around inf 63.1%

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(1 + \left(4 \cdot -1 + -6 \cdot \color{blue}{\left(z \cdot -1\right)}\right)\right) \]
      8. associate-*l*63.1%

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

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

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

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

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

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

        \[\leadsto x \cdot \left(\color{blue}{-1 \cdot 3} + -1 \cdot \left(-6 \cdot z\right)\right) \]
      15. distribute-lft-in63.1%

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

        \[\leadsto x \cdot \left(-1 \cdot \color{blue}{\left(-6 \cdot z + 3\right)}\right) \]
      17. distribute-lft-in63.1%

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    7. Simplified61.9%

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

    if 1.55000000000000001e-71 < z < 1.99999999999999985e-24

    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. +-commutative99.7%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{6 \cdot \left(-z\right) + 6 \cdot \frac{2}{3}}, x\right) \]
      7. neg-mul-1100.0%

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

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

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{z \cdot \left(6 \cdot -1\right)} + 6 \cdot \frac{2}{3}, x\right) \]
      10. fma-def100.0%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\mathsf{fma}\left(z, 6 \cdot -1, 6 \cdot \frac{2}{3}\right)}, x\right) \]
      11. metadata-eval100.0%

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

        \[\leadsto \mathsf{fma}\left(y - x, \mathsf{fma}\left(z, -6, 6 \cdot \color{blue}{0.6666666666666666}\right), x\right) \]
      13. metadata-eval100.0%

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

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

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

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

        \[\leadsto \color{blue}{y \cdot 4} \]
    7. Simplified78.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -9 \cdot 10^{-5}:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{elif}\;z \leq 1.55 \cdot 10^{-71}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 2 \cdot 10^{-24}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \end{array} \]

Alternative 7: 72.9% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(-3 + z \cdot 6\right)\\ t_1 := -6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{if}\;z \leq -9 \cdot 10^{-5}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1.3 \cdot 10^{-71}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1.65 \cdot 10^{-24}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 165:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* x (+ -3.0 (* z 6.0)))) (t_1 (* -6.0 (* (- y x) z))))
   (if (<= z -9e-5)
     t_1
     (if (<= z 1.3e-71)
       t_0
       (if (<= z 1.65e-24) (* 4.0 y) (if (<= z 165.0) t_0 t_1))))))
double code(double x, double y, double z) {
	double t_0 = x * (-3.0 + (z * 6.0));
	double t_1 = -6.0 * ((y - x) * z);
	double tmp;
	if (z <= -9e-5) {
		tmp = t_1;
	} else if (z <= 1.3e-71) {
		tmp = t_0;
	} else if (z <= 1.65e-24) {
		tmp = 4.0 * y;
	} else if (z <= 165.0) {
		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 = x * ((-3.0d0) + (z * 6.0d0))
    t_1 = (-6.0d0) * ((y - x) * z)
    if (z <= (-9d-5)) then
        tmp = t_1
    else if (z <= 1.3d-71) then
        tmp = t_0
    else if (z <= 1.65d-24) then
        tmp = 4.0d0 * y
    else if (z <= 165.0d0) 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 = x * (-3.0 + (z * 6.0));
	double t_1 = -6.0 * ((y - x) * z);
	double tmp;
	if (z <= -9e-5) {
		tmp = t_1;
	} else if (z <= 1.3e-71) {
		tmp = t_0;
	} else if (z <= 1.65e-24) {
		tmp = 4.0 * y;
	} else if (z <= 165.0) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x * (-3.0 + (z * 6.0))
	t_1 = -6.0 * ((y - x) * z)
	tmp = 0
	if z <= -9e-5:
		tmp = t_1
	elif z <= 1.3e-71:
		tmp = t_0
	elif z <= 1.65e-24:
		tmp = 4.0 * y
	elif z <= 165.0:
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(x * Float64(-3.0 + Float64(z * 6.0)))
	t_1 = Float64(-6.0 * Float64(Float64(y - x) * z))
	tmp = 0.0
	if (z <= -9e-5)
		tmp = t_1;
	elseif (z <= 1.3e-71)
		tmp = t_0;
	elseif (z <= 1.65e-24)
		tmp = Float64(4.0 * y);
	elseif (z <= 165.0)
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x * (-3.0 + (z * 6.0));
	t_1 = -6.0 * ((y - x) * z);
	tmp = 0.0;
	if (z <= -9e-5)
		tmp = t_1;
	elseif (z <= 1.3e-71)
		tmp = t_0;
	elseif (z <= 1.65e-24)
		tmp = 4.0 * y;
	elseif (z <= 165.0)
		tmp = t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(-3.0 + N[(z * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -9e-5], t$95$1, If[LessEqual[z, 1.3e-71], t$95$0, If[LessEqual[z, 1.65e-24], N[(4.0 * y), $MachinePrecision], If[LessEqual[z, 165.0], t$95$0, t$95$1]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x \cdot \left(-3 + z \cdot 6\right)\\
t_1 := -6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{if}\;z \leq -9 \cdot 10^{-5}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 1.3 \cdot 10^{-71}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq 1.65 \cdot 10^{-24}:\\
\;\;\;\;4 \cdot y\\

\mathbf{elif}\;z \leq 165:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -9.00000000000000057e-5 or 165 < z

    1. Initial program 99.8%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Taylor expanded in z around 0 99.7%

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

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

    if -9.00000000000000057e-5 < z < 1.2999999999999999e-71 or 1.64999999999999992e-24 < z < 165

    1. Initial program 99.3%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Taylor expanded in x around inf 63.1%

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(1 + \left(4 \cdot -1 + -6 \cdot \color{blue}{\left(z \cdot -1\right)}\right)\right) \]
      8. associate-*l*63.1%

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

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

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

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

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

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

        \[\leadsto x \cdot \left(\color{blue}{-1 \cdot 3} + -1 \cdot \left(-6 \cdot z\right)\right) \]
      15. distribute-lft-in63.1%

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

        \[\leadsto x \cdot \left(-1 \cdot \color{blue}{\left(-6 \cdot z + 3\right)}\right) \]
      17. distribute-lft-in63.1%

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

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

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

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

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

    if 1.2999999999999999e-71 < z < 1.64999999999999992e-24

    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. +-commutative99.7%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{6 \cdot \left(-z\right) + 6 \cdot \frac{2}{3}}, x\right) \]
      7. neg-mul-1100.0%

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

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

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{z \cdot \left(6 \cdot -1\right)} + 6 \cdot \frac{2}{3}, x\right) \]
      10. fma-def100.0%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\mathsf{fma}\left(z, 6 \cdot -1, 6 \cdot \frac{2}{3}\right)}, x\right) \]
      11. metadata-eval100.0%

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

        \[\leadsto \mathsf{fma}\left(y - x, \mathsf{fma}\left(z, -6, 6 \cdot \color{blue}{0.6666666666666666}\right), x\right) \]
      13. metadata-eval100.0%

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

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

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

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

        \[\leadsto \color{blue}{y \cdot 4} \]
    7. Simplified78.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -9 \cdot 10^{-5}:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{elif}\;z \leq 1.3 \cdot 10^{-71}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{elif}\;z \leq 1.65 \cdot 10^{-24}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 165:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \end{array} \]

Alternative 8: 72.9% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{if}\;z \leq -9 \cdot 10^{-5}:\\ \;\;\;\;z \cdot \left(6 \cdot \left(x - y\right)\right)\\ \mathbf{elif}\;z \leq 2.2 \cdot 10^{-70}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 2.9 \cdot 10^{-24}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 165:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* x (+ -3.0 (* z 6.0)))))
   (if (<= z -9e-5)
     (* z (* 6.0 (- x y)))
     (if (<= z 2.2e-70)
       t_0
       (if (<= z 2.9e-24)
         (* 4.0 y)
         (if (<= z 165.0) t_0 (* -6.0 (* (- y x) z))))))))
double code(double x, double y, double z) {
	double t_0 = x * (-3.0 + (z * 6.0));
	double tmp;
	if (z <= -9e-5) {
		tmp = z * (6.0 * (x - y));
	} else if (z <= 2.2e-70) {
		tmp = t_0;
	} else if (z <= 2.9e-24) {
		tmp = 4.0 * y;
	} else if (z <= 165.0) {
		tmp = t_0;
	} else {
		tmp = -6.0 * ((y - x) * z);
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = x * ((-3.0d0) + (z * 6.0d0))
    if (z <= (-9d-5)) then
        tmp = z * (6.0d0 * (x - y))
    else if (z <= 2.2d-70) then
        tmp = t_0
    else if (z <= 2.9d-24) then
        tmp = 4.0d0 * y
    else if (z <= 165.0d0) then
        tmp = t_0
    else
        tmp = (-6.0d0) * ((y - x) * z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = x * (-3.0 + (z * 6.0));
	double tmp;
	if (z <= -9e-5) {
		tmp = z * (6.0 * (x - y));
	} else if (z <= 2.2e-70) {
		tmp = t_0;
	} else if (z <= 2.9e-24) {
		tmp = 4.0 * y;
	} else if (z <= 165.0) {
		tmp = t_0;
	} else {
		tmp = -6.0 * ((y - x) * z);
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x * (-3.0 + (z * 6.0))
	tmp = 0
	if z <= -9e-5:
		tmp = z * (6.0 * (x - y))
	elif z <= 2.2e-70:
		tmp = t_0
	elif z <= 2.9e-24:
		tmp = 4.0 * y
	elif z <= 165.0:
		tmp = t_0
	else:
		tmp = -6.0 * ((y - x) * z)
	return tmp
function code(x, y, z)
	t_0 = Float64(x * Float64(-3.0 + Float64(z * 6.0)))
	tmp = 0.0
	if (z <= -9e-5)
		tmp = Float64(z * Float64(6.0 * Float64(x - y)));
	elseif (z <= 2.2e-70)
		tmp = t_0;
	elseif (z <= 2.9e-24)
		tmp = Float64(4.0 * y);
	elseif (z <= 165.0)
		tmp = t_0;
	else
		tmp = Float64(-6.0 * Float64(Float64(y - x) * z));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x * (-3.0 + (z * 6.0));
	tmp = 0.0;
	if (z <= -9e-5)
		tmp = z * (6.0 * (x - y));
	elseif (z <= 2.2e-70)
		tmp = t_0;
	elseif (z <= 2.9e-24)
		tmp = 4.0 * y;
	elseif (z <= 165.0)
		tmp = t_0;
	else
		tmp = -6.0 * ((y - x) * z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(-3.0 + N[(z * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -9e-5], N[(z * N[(6.0 * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.2e-70], t$95$0, If[LessEqual[z, 2.9e-24], N[(4.0 * y), $MachinePrecision], If[LessEqual[z, 165.0], t$95$0, N[(-6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x \cdot \left(-3 + z \cdot 6\right)\\
\mathbf{if}\;z \leq -9 \cdot 10^{-5}:\\
\;\;\;\;z \cdot \left(6 \cdot \left(x - y\right)\right)\\

\mathbf{elif}\;z \leq 2.2 \cdot 10^{-70}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq 2.9 \cdot 10^{-24}:\\
\;\;\;\;4 \cdot y\\

\mathbf{elif}\;z \leq 165:\\
\;\;\;\;t_0\\

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


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

    1. Initial program 100.0%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Taylor expanded in z around 0 99.8%

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

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

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

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

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

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

        \[\leadsto 4 \cdot \left(y - x\right) + \left(\left(\left(z \cdot 6\right) \cdot x + \color{blue}{\left(-6 \cdot \left(y \cdot z\right)\right)}\right) + x\right) \]
      5. associate-*l*93.8%

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

        \[\leadsto 4 \cdot \left(y - x\right) + \left(\left(\left(z \cdot 6\right) \cdot x + \left(-\color{blue}{z \cdot \left(6 \cdot y\right)}\right)\right) + x\right) \]
      7. associate-*r*92.1%

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

        \[\leadsto 4 \cdot \left(y - x\right) + \left(\left(\left(z \cdot 6\right) \cdot x + \color{blue}{\left(z \cdot 6\right) \cdot \left(-y\right)}\right) + x\right) \]
      9. neg-mul-192.1%

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

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

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

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

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

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

    if -9.00000000000000057e-5 < z < 2.1999999999999999e-70 or 2.8999999999999999e-24 < z < 165

    1. Initial program 99.3%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Taylor expanded in x around inf 63.1%

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(1 + \left(4 \cdot -1 + -6 \cdot \color{blue}{\left(z \cdot -1\right)}\right)\right) \]
      8. associate-*l*63.1%

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

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

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

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

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

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

        \[\leadsto x \cdot \left(\color{blue}{-1 \cdot 3} + -1 \cdot \left(-6 \cdot z\right)\right) \]
      15. distribute-lft-in63.1%

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

        \[\leadsto x \cdot \left(-1 \cdot \color{blue}{\left(-6 \cdot z + 3\right)}\right) \]
      17. distribute-lft-in63.1%

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

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

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

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

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

    if 2.1999999999999999e-70 < z < 2.8999999999999999e-24

    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. +-commutative99.7%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{6 \cdot \left(-z\right) + 6 \cdot \frac{2}{3}}, x\right) \]
      7. neg-mul-1100.0%

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

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

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{z \cdot \left(6 \cdot -1\right)} + 6 \cdot \frac{2}{3}, x\right) \]
      10. fma-def100.0%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\mathsf{fma}\left(z, 6 \cdot -1, 6 \cdot \frac{2}{3}\right)}, x\right) \]
      11. metadata-eval100.0%

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

        \[\leadsto \mathsf{fma}\left(y - x, \mathsf{fma}\left(z, -6, 6 \cdot \color{blue}{0.6666666666666666}\right), x\right) \]
      13. metadata-eval100.0%

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

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

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

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

        \[\leadsto \color{blue}{y \cdot 4} \]
    7. Simplified78.5%

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

    if 165 < z

    1. Initial program 99.6%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Taylor expanded in z around 0 99.7%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -9 \cdot 10^{-5}:\\ \;\;\;\;z \cdot \left(6 \cdot \left(x - y\right)\right)\\ \mathbf{elif}\;z \leq 2.2 \cdot 10^{-70}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{elif}\;z \leq 2.9 \cdot 10^{-24}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 165:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \end{array} \]

Alternative 9: 99.7% accurate, 0.9× speedup?

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

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

    \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
  2. Taylor expanded in z around 0 99.8%

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

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

Alternative 10: 50.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -6 \cdot \left(y \cdot z\right)\\ \mathbf{if}\;z \leq -9 \cdot 10^{-5}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 5.9 \cdot 10^{-71}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 6.2 \cdot 10^{-25}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 0.55:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* -6.0 (* y z))))
   (if (<= z -9e-5)
     t_0
     (if (<= z 5.9e-71)
       (* x -3.0)
       (if (<= z 6.2e-25) (* 4.0 y) (if (<= z 0.55) (* x -3.0) t_0))))))
double code(double x, double y, double z) {
	double t_0 = -6.0 * (y * z);
	double tmp;
	if (z <= -9e-5) {
		tmp = t_0;
	} else if (z <= 5.9e-71) {
		tmp = x * -3.0;
	} else if (z <= 6.2e-25) {
		tmp = 4.0 * y;
	} else if (z <= 0.55) {
		tmp = x * -3.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (-6.0d0) * (y * z)
    if (z <= (-9d-5)) then
        tmp = t_0
    else if (z <= 5.9d-71) then
        tmp = x * (-3.0d0)
    else if (z <= 6.2d-25) then
        tmp = 4.0d0 * y
    else if (z <= 0.55d0) then
        tmp = x * (-3.0d0)
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = -6.0 * (y * z);
	double tmp;
	if (z <= -9e-5) {
		tmp = t_0;
	} else if (z <= 5.9e-71) {
		tmp = x * -3.0;
	} else if (z <= 6.2e-25) {
		tmp = 4.0 * y;
	} else if (z <= 0.55) {
		tmp = x * -3.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = -6.0 * (y * z)
	tmp = 0
	if z <= -9e-5:
		tmp = t_0
	elif z <= 5.9e-71:
		tmp = x * -3.0
	elif z <= 6.2e-25:
		tmp = 4.0 * y
	elif z <= 0.55:
		tmp = x * -3.0
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(-6.0 * Float64(y * z))
	tmp = 0.0
	if (z <= -9e-5)
		tmp = t_0;
	elseif (z <= 5.9e-71)
		tmp = Float64(x * -3.0);
	elseif (z <= 6.2e-25)
		tmp = Float64(4.0 * y);
	elseif (z <= 0.55)
		tmp = Float64(x * -3.0);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = -6.0 * (y * z);
	tmp = 0.0;
	if (z <= -9e-5)
		tmp = t_0;
	elseif (z <= 5.9e-71)
		tmp = x * -3.0;
	elseif (z <= 6.2e-25)
		tmp = 4.0 * y;
	elseif (z <= 0.55)
		tmp = x * -3.0;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(-6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -9e-5], t$95$0, If[LessEqual[z, 5.9e-71], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 6.2e-25], N[(4.0 * y), $MachinePrecision], If[LessEqual[z, 0.55], N[(x * -3.0), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := -6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -9 \cdot 10^{-5}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;z \leq 6.2 \cdot 10^{-25}:\\
\;\;\;\;4 \cdot y\\

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

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -9.00000000000000057e-5 or 0.55000000000000004 < z

    1. Initial program 99.8%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Taylor expanded in z around 0 99.7%

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

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

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

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

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

    if -9.00000000000000057e-5 < z < 5.90000000000000002e-71 or 6.19999999999999989e-25 < z < 0.55000000000000004

    1. Initial program 99.3%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Taylor expanded in x around inf 63.1%

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(1 + \left(4 \cdot -1 + -6 \cdot \color{blue}{\left(z \cdot -1\right)}\right)\right) \]
      8. associate-*l*63.1%

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

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

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

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

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

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

        \[\leadsto x \cdot \left(\color{blue}{-1 \cdot 3} + -1 \cdot \left(-6 \cdot z\right)\right) \]
      15. distribute-lft-in63.1%

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

        \[\leadsto x \cdot \left(-1 \cdot \color{blue}{\left(-6 \cdot z + 3\right)}\right) \]
      17. distribute-lft-in63.1%

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    7. Simplified61.9%

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

    if 5.90000000000000002e-71 < z < 6.19999999999999989e-25

    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. +-commutative99.7%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{6 \cdot \left(-z\right) + 6 \cdot \frac{2}{3}}, x\right) \]
      7. neg-mul-1100.0%

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

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

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{z \cdot \left(6 \cdot -1\right)} + 6 \cdot \frac{2}{3}, x\right) \]
      10. fma-def100.0%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\mathsf{fma}\left(z, 6 \cdot -1, 6 \cdot \frac{2}{3}\right)}, x\right) \]
      11. metadata-eval100.0%

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

        \[\leadsto \mathsf{fma}\left(y - x, \mathsf{fma}\left(z, -6, 6 \cdot \color{blue}{0.6666666666666666}\right), x\right) \]
      13. metadata-eval100.0%

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

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

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

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

        \[\leadsto \color{blue}{y \cdot 4} \]
    7. Simplified78.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -9 \cdot 10^{-5}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 5.9 \cdot 10^{-71}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 6.2 \cdot 10^{-25}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 0.55:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \end{array} \]

Alternative 11: 97.9% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 100.0%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Taylor expanded in z around 0 99.8%

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

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

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

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

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

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

        \[\leadsto 4 \cdot \left(y - x\right) + \left(\left(\left(z \cdot 6\right) \cdot x + \color{blue}{\left(-6 \cdot \left(y \cdot z\right)\right)}\right) + x\right) \]
      5. associate-*l*93.7%

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

        \[\leadsto 4 \cdot \left(y - x\right) + \left(\left(\left(z \cdot 6\right) \cdot x + \left(-\color{blue}{z \cdot \left(6 \cdot y\right)}\right)\right) + x\right) \]
      7. associate-*r*92.0%

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

        \[\leadsto 4 \cdot \left(y - x\right) + \left(\left(\left(z \cdot 6\right) \cdot x + \color{blue}{\left(z \cdot 6\right) \cdot \left(-y\right)}\right) + x\right) \]
      9. neg-mul-192.0%

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

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

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

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

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

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

    if -0.55000000000000004 < z < 0.599999999999999978

    1. Initial program 99.4%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Taylor expanded in x around 0 99.7%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(1 + -6 \cdot \left(0.6666666666666666 - z\right), x, 6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\right)} \]
      2. associate-*r*99.7%

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

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

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

    if 0.599999999999999978 < z

    1. Initial program 99.6%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Taylor expanded in z around inf 96.9%

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

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

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

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

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

Alternative 12: 97.9% accurate, 1.2× speedup?

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

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

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

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


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

    1. Initial program 100.0%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Taylor expanded in z around 0 99.8%

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

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

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

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

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

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

        \[\leadsto 4 \cdot \left(y - x\right) + \left(\left(\left(z \cdot 6\right) \cdot x + \color{blue}{\left(-6 \cdot \left(y \cdot z\right)\right)}\right) + x\right) \]
      5. associate-*l*93.7%

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

        \[\leadsto 4 \cdot \left(y - x\right) + \left(\left(\left(z \cdot 6\right) \cdot x + \left(-\color{blue}{z \cdot \left(6 \cdot y\right)}\right)\right) + x\right) \]
      7. associate-*r*92.0%

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

        \[\leadsto 4 \cdot \left(y - x\right) + \left(\left(\left(z \cdot 6\right) \cdot x + \color{blue}{\left(z \cdot 6\right) \cdot \left(-y\right)}\right) + x\right) \]
      9. neg-mul-192.0%

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

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

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

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

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

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

    if -0.55000000000000004 < z < 0.599999999999999978

    1. Initial program 99.4%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Taylor expanded in x around 0 99.7%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(1 + -6 \cdot \left(0.6666666666666666 - z\right), x, 6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\right)} \]
      2. associate-*r*99.7%

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

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

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

    if 0.599999999999999978 < z

    1. Initial program 99.6%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Taylor expanded in z around 0 99.7%

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

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

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

Alternative 13: 99.7% accurate, 1.2× speedup?

\[\begin{array}{l} \\ x + \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\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(y - x) * Float64(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[(y - x), $MachinePrecision] * N[(6.0 * N[(0.6666666666666666 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x + \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)
\end{array}
Derivation
  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. associate-*l*99.8%

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

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

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

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

Alternative 14: 38.1% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2.2 \cdot 10^{-45}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;x \leq 5.4 \cdot 10^{-142}:\\ \;\;\;\;4 \cdot y\\ \mathbf{else}:\\ \;\;\;\;x \cdot -3\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= x -2.2e-45) (* x -3.0) (if (<= x 5.4e-142) (* 4.0 y) (* x -3.0))))
double code(double x, double y, double z) {
	double tmp;
	if (x <= -2.2e-45) {
		tmp = x * -3.0;
	} else if (x <= 5.4e-142) {
		tmp = 4.0 * y;
	} else {
		tmp = x * -3.0;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (x <= (-2.2d-45)) then
        tmp = x * (-3.0d0)
    else if (x <= 5.4d-142) then
        tmp = 4.0d0 * y
    else
        tmp = x * (-3.0d0)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (x <= -2.2e-45) {
		tmp = x * -3.0;
	} else if (x <= 5.4e-142) {
		tmp = 4.0 * y;
	} else {
		tmp = x * -3.0;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if x <= -2.2e-45:
		tmp = x * -3.0
	elif x <= 5.4e-142:
		tmp = 4.0 * y
	else:
		tmp = x * -3.0
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (x <= -2.2e-45)
		tmp = Float64(x * -3.0);
	elseif (x <= 5.4e-142)
		tmp = Float64(4.0 * y);
	else
		tmp = Float64(x * -3.0);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (x <= -2.2e-45)
		tmp = x * -3.0;
	elseif (x <= 5.4e-142)
		tmp = 4.0 * y;
	else
		tmp = x * -3.0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[x, -2.2e-45], N[(x * -3.0), $MachinePrecision], If[LessEqual[x, 5.4e-142], N[(4.0 * y), $MachinePrecision], N[(x * -3.0), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.2 \cdot 10^{-45}:\\
\;\;\;\;x \cdot -3\\

\mathbf{elif}\;x \leq 5.4 \cdot 10^{-142}:\\
\;\;\;\;4 \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.19999999999999993e-45 or 5.3999999999999996e-142 < x

    1. Initial program 99.6%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Taylor expanded in x around inf 69.9%

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(1 + \left(4 \cdot -1 + -6 \cdot \color{blue}{\left(z \cdot -1\right)}\right)\right) \]
      8. associate-*l*69.9%

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

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

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

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

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

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

        \[\leadsto x \cdot \left(\color{blue}{-1 \cdot 3} + -1 \cdot \left(-6 \cdot z\right)\right) \]
      15. distribute-lft-in69.9%

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

        \[\leadsto x \cdot \left(-1 \cdot \color{blue}{\left(-6 \cdot z + 3\right)}\right) \]
      17. distribute-lft-in69.9%

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    7. Simplified40.0%

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

    if -2.19999999999999993e-45 < x < 5.3999999999999996e-142

    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. +-commutative99.5%

        \[\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-def99.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. +-commutative99.8%

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

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{6 \cdot \left(-z\right) + 6 \cdot \frac{2}{3}}, x\right) \]
      7. neg-mul-199.8%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot 4} \]
    7. Simplified44.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.2 \cdot 10^{-45}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;x \leq 5.4 \cdot 10^{-142}:\\ \;\;\;\;4 \cdot y\\ \mathbf{else}:\\ \;\;\;\;x \cdot -3\\ \end{array} \]

Alternative 15: 26.7% 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.6%

    \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
  2. Taylor expanded in x around inf 53.8%

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

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

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

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

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

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

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

      \[\leadsto x \cdot \left(1 + \left(4 \cdot -1 + -6 \cdot \color{blue}{\left(z \cdot -1\right)}\right)\right) \]
    8. associate-*l*53.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot -3} \]
  7. Simplified30.6%

    \[\leadsto \color{blue}{x \cdot -3} \]
  8. Final simplification30.6%

    \[\leadsto x \cdot -3 \]

Reproduce

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