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

Percentage Accurate: 99.5% → 99.7%
Time: 10.8s
Alternatives: 16
Speedup: 1.2×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 16 alternatives:

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

Initial Program: 99.5% accurate, 1.0× speedup?

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

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

Alternative 1: 99.7% accurate, 0.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 50.1% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(z \cdot 6\right)\\ \mathbf{if}\;z \leq -3.3 \cdot 10^{+90}:\\ \;\;\;\;z \cdot \left(y \cdot -6\right)\\ \mathbf{elif}\;z \leq -4.2:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -7.2 \cdot 10^{-129}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -3.4 \cdot 10^{-268}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 3.1 \cdot 10^{-264}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 3.9 \cdot 10^{-119}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.56:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* x (* z 6.0))))
   (if (<= z -3.3e+90)
     (* z (* y -6.0))
     (if (<= z -4.2)
       t_0
       (if (<= z -7.2e-129)
         (* y 4.0)
         (if (<= z -3.4e-268)
           (* x -3.0)
           (if (<= z 3.1e-264)
             (* y 4.0)
             (if (<= z 3.9e-119)
               (* x -3.0)
               (if (<= z 0.56) (* y 4.0) t_0)))))))))
double code(double x, double y, double z) {
	double t_0 = x * (z * 6.0);
	double tmp;
	if (z <= -3.3e+90) {
		tmp = z * (y * -6.0);
	} else if (z <= -4.2) {
		tmp = t_0;
	} else if (z <= -7.2e-129) {
		tmp = y * 4.0;
	} else if (z <= -3.4e-268) {
		tmp = x * -3.0;
	} else if (z <= 3.1e-264) {
		tmp = y * 4.0;
	} else if (z <= 3.9e-119) {
		tmp = x * -3.0;
	} else if (z <= 0.56) {
		tmp = y * 4.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = x * (z * 6.0d0)
    if (z <= (-3.3d+90)) then
        tmp = z * (y * (-6.0d0))
    else if (z <= (-4.2d0)) then
        tmp = t_0
    else if (z <= (-7.2d-129)) then
        tmp = y * 4.0d0
    else if (z <= (-3.4d-268)) then
        tmp = x * (-3.0d0)
    else if (z <= 3.1d-264) then
        tmp = y * 4.0d0
    else if (z <= 3.9d-119) then
        tmp = x * (-3.0d0)
    else if (z <= 0.56d0) then
        tmp = y * 4.0d0
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = x * (z * 6.0);
	double tmp;
	if (z <= -3.3e+90) {
		tmp = z * (y * -6.0);
	} else if (z <= -4.2) {
		tmp = t_0;
	} else if (z <= -7.2e-129) {
		tmp = y * 4.0;
	} else if (z <= -3.4e-268) {
		tmp = x * -3.0;
	} else if (z <= 3.1e-264) {
		tmp = y * 4.0;
	} else if (z <= 3.9e-119) {
		tmp = x * -3.0;
	} else if (z <= 0.56) {
		tmp = y * 4.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x * (z * 6.0)
	tmp = 0
	if z <= -3.3e+90:
		tmp = z * (y * -6.0)
	elif z <= -4.2:
		tmp = t_0
	elif z <= -7.2e-129:
		tmp = y * 4.0
	elif z <= -3.4e-268:
		tmp = x * -3.0
	elif z <= 3.1e-264:
		tmp = y * 4.0
	elif z <= 3.9e-119:
		tmp = x * -3.0
	elif z <= 0.56:
		tmp = y * 4.0
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(x * Float64(z * 6.0))
	tmp = 0.0
	if (z <= -3.3e+90)
		tmp = Float64(z * Float64(y * -6.0));
	elseif (z <= -4.2)
		tmp = t_0;
	elseif (z <= -7.2e-129)
		tmp = Float64(y * 4.0);
	elseif (z <= -3.4e-268)
		tmp = Float64(x * -3.0);
	elseif (z <= 3.1e-264)
		tmp = Float64(y * 4.0);
	elseif (z <= 3.9e-119)
		tmp = Float64(x * -3.0);
	elseif (z <= 0.56)
		tmp = Float64(y * 4.0);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x * (z * 6.0);
	tmp = 0.0;
	if (z <= -3.3e+90)
		tmp = z * (y * -6.0);
	elseif (z <= -4.2)
		tmp = t_0;
	elseif (z <= -7.2e-129)
		tmp = y * 4.0;
	elseif (z <= -3.4e-268)
		tmp = x * -3.0;
	elseif (z <= 3.1e-264)
		tmp = y * 4.0;
	elseif (z <= 3.9e-119)
		tmp = x * -3.0;
	elseif (z <= 0.56)
		tmp = y * 4.0;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(z * 6.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.3e+90], N[(z * N[(y * -6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -4.2], t$95$0, If[LessEqual[z, -7.2e-129], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, -3.4e-268], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 3.1e-264], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 3.9e-119], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 0.56], N[(y * 4.0), $MachinePrecision], t$95$0]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -4.2:\\
\;\;\;\;t\_0\\

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

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

\mathbf{elif}\;z \leq 3.1 \cdot 10^{-264}:\\
\;\;\;\;y \cdot 4\\

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

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

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


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

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.30000000000000008e90 < z < -4.20000000000000018 or 0.56000000000000005 < z

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(z \cdot 6\right)} \]
    10. Simplified59.8%

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

    if -4.20000000000000018 < z < -7.2e-129 or -3.4e-268 < z < 3.1000000000000002e-264 or 3.8999999999999999e-119 < z < 0.56000000000000005

    1. Initial program 98.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -7.2e-129 < z < -3.4e-268 or 3.1000000000000002e-264 < z < 3.8999999999999999e-119

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.3 \cdot 10^{+90}:\\ \;\;\;\;z \cdot \left(y \cdot -6\right)\\ \mathbf{elif}\;z \leq -4.2:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq -7.2 \cdot 10^{-129}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -3.4 \cdot 10^{-268}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 3.1 \cdot 10^{-264}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 3.9 \cdot 10^{-119}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.56:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 50.2% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;z \leq -5:\\
\;\;\;\;t\_0\\

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

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

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

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

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

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


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

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.6e90 < z < -5 or 0.5 < z

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(z \cdot 6\right)} \]
    10. Simplified59.8%

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

    if -5 < z < -3.60000000000000006e-137 or -5.7999999999999999e-260 < z < 1.25e-267 or 1.6e-120 < z < 0.5

    1. Initial program 98.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.60000000000000006e-137 < z < -5.7999999999999999e-260 or 1.25e-267 < z < 1.6e-120

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.6 \cdot 10^{+90}:\\ \;\;\;\;y \cdot \left(z \cdot -6\right)\\ \mathbf{elif}\;z \leq -5:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq -3.6 \cdot 10^{-137}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -5.8 \cdot 10^{-260}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.25 \cdot 10^{-267}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 1.6 \cdot 10^{-120}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 50.2% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;z \leq -0.39:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq -5 \cdot 10^{-137}:\\
\;\;\;\;y \cdot 4\\

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

\mathbf{elif}\;z \leq 3 \cdot 10^{-266}:\\
\;\;\;\;y \cdot 4\\

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

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

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


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

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.4999999999999998e90 < z < -0.39000000000000001 or 0.650000000000000022 < z

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(z \cdot 6\right)} \]
    10. Simplified59.8%

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

    if -0.39000000000000001 < z < -5.00000000000000001e-137 or -9.2e-261 < z < 3e-266 or 1.14999999999999992e-115 < z < 0.650000000000000022

    1. Initial program 98.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.00000000000000001e-137 < z < -9.2e-261 or 3e-266 < z < 1.14999999999999992e-115

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 50.2% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 6 \cdot \left(x \cdot z\right)\\ \mathbf{if}\;z \leq -3.6 \cdot 10^{+90}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -5.8:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -4 \cdot 10^{-127}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -1 \cdot 10^{-258}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 7.8 \cdot 10^{-267}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 9.5 \cdot 10^{-118}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.65:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* 6.0 (* x z))))
   (if (<= z -3.6e+90)
     (* -6.0 (* y z))
     (if (<= z -5.8)
       t_0
       (if (<= z -4e-127)
         (* y 4.0)
         (if (<= z -1e-258)
           (* x -3.0)
           (if (<= z 7.8e-267)
             (* y 4.0)
             (if (<= z 9.5e-118)
               (* x -3.0)
               (if (<= z 0.65) (* y 4.0) t_0)))))))))
double code(double x, double y, double z) {
	double t_0 = 6.0 * (x * z);
	double tmp;
	if (z <= -3.6e+90) {
		tmp = -6.0 * (y * z);
	} else if (z <= -5.8) {
		tmp = t_0;
	} else if (z <= -4e-127) {
		tmp = y * 4.0;
	} else if (z <= -1e-258) {
		tmp = x * -3.0;
	} else if (z <= 7.8e-267) {
		tmp = y * 4.0;
	} else if (z <= 9.5e-118) {
		tmp = x * -3.0;
	} else if (z <= 0.65) {
		tmp = y * 4.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = 6.0d0 * (x * z)
    if (z <= (-3.6d+90)) then
        tmp = (-6.0d0) * (y * z)
    else if (z <= (-5.8d0)) then
        tmp = t_0
    else if (z <= (-4d-127)) then
        tmp = y * 4.0d0
    else if (z <= (-1d-258)) then
        tmp = x * (-3.0d0)
    else if (z <= 7.8d-267) then
        tmp = y * 4.0d0
    else if (z <= 9.5d-118) then
        tmp = x * (-3.0d0)
    else if (z <= 0.65d0) then
        tmp = y * 4.0d0
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = 6.0 * (x * z);
	double tmp;
	if (z <= -3.6e+90) {
		tmp = -6.0 * (y * z);
	} else if (z <= -5.8) {
		tmp = t_0;
	} else if (z <= -4e-127) {
		tmp = y * 4.0;
	} else if (z <= -1e-258) {
		tmp = x * -3.0;
	} else if (z <= 7.8e-267) {
		tmp = y * 4.0;
	} else if (z <= 9.5e-118) {
		tmp = x * -3.0;
	} else if (z <= 0.65) {
		tmp = y * 4.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 6.0 * (x * z)
	tmp = 0
	if z <= -3.6e+90:
		tmp = -6.0 * (y * z)
	elif z <= -5.8:
		tmp = t_0
	elif z <= -4e-127:
		tmp = y * 4.0
	elif z <= -1e-258:
		tmp = x * -3.0
	elif z <= 7.8e-267:
		tmp = y * 4.0
	elif z <= 9.5e-118:
		tmp = x * -3.0
	elif z <= 0.65:
		tmp = y * 4.0
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(6.0 * Float64(x * z))
	tmp = 0.0
	if (z <= -3.6e+90)
		tmp = Float64(-6.0 * Float64(y * z));
	elseif (z <= -5.8)
		tmp = t_0;
	elseif (z <= -4e-127)
		tmp = Float64(y * 4.0);
	elseif (z <= -1e-258)
		tmp = Float64(x * -3.0);
	elseif (z <= 7.8e-267)
		tmp = Float64(y * 4.0);
	elseif (z <= 9.5e-118)
		tmp = Float64(x * -3.0);
	elseif (z <= 0.65)
		tmp = Float64(y * 4.0);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 6.0 * (x * z);
	tmp = 0.0;
	if (z <= -3.6e+90)
		tmp = -6.0 * (y * z);
	elseif (z <= -5.8)
		tmp = t_0;
	elseif (z <= -4e-127)
		tmp = y * 4.0;
	elseif (z <= -1e-258)
		tmp = x * -3.0;
	elseif (z <= 7.8e-267)
		tmp = y * 4.0;
	elseif (z <= 9.5e-118)
		tmp = x * -3.0;
	elseif (z <= 0.65)
		tmp = y * 4.0;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.6e+90], N[(-6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -5.8], t$95$0, If[LessEqual[z, -4e-127], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, -1e-258], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 7.8e-267], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 9.5e-118], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 0.65], N[(y * 4.0), $MachinePrecision], t$95$0]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -5.8:\\
\;\;\;\;t\_0\\

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

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

\mathbf{elif}\;z \leq 7.8 \cdot 10^{-267}:\\
\;\;\;\;y \cdot 4\\

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

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

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


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

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.6e90 < z < -5.79999999999999982 or 0.650000000000000022 < z

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

    if -5.79999999999999982 < z < -4.0000000000000001e-127 or -9.99999999999999954e-259 < z < 7.79999999999999954e-267 or 9.49999999999999931e-118 < z < 0.650000000000000022

    1. Initial program 98.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.0000000000000001e-127 < z < -9.99999999999999954e-259 or 7.79999999999999954e-267 < z < 9.49999999999999931e-118

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.6 \cdot 10^{+90}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -5.8:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -4 \cdot 10^{-127}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -1 \cdot 10^{-258}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 7.8 \cdot 10^{-267}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 9.5 \cdot 10^{-118}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.65:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 73.6% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y \cdot \left(4 + z \cdot -6\right)\\ t_1 := \left(y - x\right) \cdot \left(z \cdot -6\right)\\ \mathbf{if}\;z \leq -470:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -6.5 \cdot 10^{-129}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -2.1 \cdot 10^{-267}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{elif}\;z \leq 4.8 \cdot 10^{-264}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 4.3 \cdot 10^{-120}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 27500:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* y (+ 4.0 (* z -6.0)))) (t_1 (* (- y x) (* z -6.0))))
   (if (<= z -470.0)
     t_1
     (if (<= z -6.5e-129)
       t_0
       (if (<= z -2.1e-267)
         (* x (+ -3.0 (* z 6.0)))
         (if (<= z 4.8e-264)
           t_0
           (if (<= z 4.3e-120) (* x -3.0) (if (<= z 27500.0) t_0 t_1))))))))
double code(double x, double y, double z) {
	double t_0 = y * (4.0 + (z * -6.0));
	double t_1 = (y - x) * (z * -6.0);
	double tmp;
	if (z <= -470.0) {
		tmp = t_1;
	} else if (z <= -6.5e-129) {
		tmp = t_0;
	} else if (z <= -2.1e-267) {
		tmp = x * (-3.0 + (z * 6.0));
	} else if (z <= 4.8e-264) {
		tmp = t_0;
	} else if (z <= 4.3e-120) {
		tmp = x * -3.0;
	} else if (z <= 27500.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 = y * (4.0d0 + (z * (-6.0d0)))
    t_1 = (y - x) * (z * (-6.0d0))
    if (z <= (-470.0d0)) then
        tmp = t_1
    else if (z <= (-6.5d-129)) then
        tmp = t_0
    else if (z <= (-2.1d-267)) then
        tmp = x * ((-3.0d0) + (z * 6.0d0))
    else if (z <= 4.8d-264) then
        tmp = t_0
    else if (z <= 4.3d-120) then
        tmp = x * (-3.0d0)
    else if (z <= 27500.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 = y * (4.0 + (z * -6.0));
	double t_1 = (y - x) * (z * -6.0);
	double tmp;
	if (z <= -470.0) {
		tmp = t_1;
	} else if (z <= -6.5e-129) {
		tmp = t_0;
	} else if (z <= -2.1e-267) {
		tmp = x * (-3.0 + (z * 6.0));
	} else if (z <= 4.8e-264) {
		tmp = t_0;
	} else if (z <= 4.3e-120) {
		tmp = x * -3.0;
	} else if (z <= 27500.0) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = y * (4.0 + (z * -6.0))
	t_1 = (y - x) * (z * -6.0)
	tmp = 0
	if z <= -470.0:
		tmp = t_1
	elif z <= -6.5e-129:
		tmp = t_0
	elif z <= -2.1e-267:
		tmp = x * (-3.0 + (z * 6.0))
	elif z <= 4.8e-264:
		tmp = t_0
	elif z <= 4.3e-120:
		tmp = x * -3.0
	elif z <= 27500.0:
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(y * Float64(4.0 + Float64(z * -6.0)))
	t_1 = Float64(Float64(y - x) * Float64(z * -6.0))
	tmp = 0.0
	if (z <= -470.0)
		tmp = t_1;
	elseif (z <= -6.5e-129)
		tmp = t_0;
	elseif (z <= -2.1e-267)
		tmp = Float64(x * Float64(-3.0 + Float64(z * 6.0)));
	elseif (z <= 4.8e-264)
		tmp = t_0;
	elseif (z <= 4.3e-120)
		tmp = Float64(x * -3.0);
	elseif (z <= 27500.0)
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = y * (4.0 + (z * -6.0));
	t_1 = (y - x) * (z * -6.0);
	tmp = 0.0;
	if (z <= -470.0)
		tmp = t_1;
	elseif (z <= -6.5e-129)
		tmp = t_0;
	elseif (z <= -2.1e-267)
		tmp = x * (-3.0 + (z * 6.0));
	elseif (z <= 4.8e-264)
		tmp = t_0;
	elseif (z <= 4.3e-120)
		tmp = x * -3.0;
	elseif (z <= 27500.0)
		tmp = t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(4.0 + N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(y - x), $MachinePrecision] * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -470.0], t$95$1, If[LessEqual[z, -6.5e-129], t$95$0, If[LessEqual[z, -2.1e-267], N[(x * N[(-3.0 + N[(z * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.8e-264], t$95$0, If[LessEqual[z, 4.3e-120], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 27500.0], t$95$0, t$95$1]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -6.5 \cdot 10^{-129}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq -2.1 \cdot 10^{-267}:\\
\;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\

\mathbf{elif}\;z \leq 4.8 \cdot 10^{-264}:\\
\;\;\;\;t\_0\\

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

\mathbf{elif}\;z \leq 27500:\\
\;\;\;\;t\_0\\

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


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

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

    if -470 < z < -6.49999999999999952e-129 or -2.1000000000000001e-267 < z < 4.7999999999999997e-264 or 4.29999999999999982e-120 < z < 27500

    1. Initial program 98.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -6.49999999999999952e-129 < z < -2.1000000000000001e-267

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.7999999999999997e-264 < z < 4.29999999999999982e-120

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -470:\\ \;\;\;\;\left(y - x\right) \cdot \left(z \cdot -6\right)\\ \mathbf{elif}\;z \leq -6.5 \cdot 10^{-129}:\\ \;\;\;\;y \cdot \left(4 + z \cdot -6\right)\\ \mathbf{elif}\;z \leq -2.1 \cdot 10^{-267}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{elif}\;z \leq 4.8 \cdot 10^{-264}:\\ \;\;\;\;y \cdot \left(4 + z \cdot -6\right)\\ \mathbf{elif}\;z \leq 4.3 \cdot 10^{-120}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 27500:\\ \;\;\;\;y \cdot \left(4 + z \cdot -6\right)\\ \mathbf{else}:\\ \;\;\;\;\left(y - x\right) \cdot \left(z \cdot -6\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 73.8% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y \cdot \left(4 + z \cdot -6\right)\\ t_1 := z \cdot \left(\left(y - x\right) \cdot -6\right)\\ \mathbf{if}\;z \leq -470:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -1.8 \cdot 10^{-137}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -3.3 \cdot 10^{-255}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{elif}\;z \leq 4.2 \cdot 10^{-264}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 6.2 \cdot 10^{-115}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 170000:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* y (+ 4.0 (* z -6.0)))) (t_1 (* z (* (- y x) -6.0))))
   (if (<= z -470.0)
     t_1
     (if (<= z -1.8e-137)
       t_0
       (if (<= z -3.3e-255)
         (* x (+ -3.0 (* z 6.0)))
         (if (<= z 4.2e-264)
           t_0
           (if (<= z 6.2e-115) (* x -3.0) (if (<= z 170000.0) t_0 t_1))))))))
double code(double x, double y, double z) {
	double t_0 = y * (4.0 + (z * -6.0));
	double t_1 = z * ((y - x) * -6.0);
	double tmp;
	if (z <= -470.0) {
		tmp = t_1;
	} else if (z <= -1.8e-137) {
		tmp = t_0;
	} else if (z <= -3.3e-255) {
		tmp = x * (-3.0 + (z * 6.0));
	} else if (z <= 4.2e-264) {
		tmp = t_0;
	} else if (z <= 6.2e-115) {
		tmp = x * -3.0;
	} else if (z <= 170000.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 = y * (4.0d0 + (z * (-6.0d0)))
    t_1 = z * ((y - x) * (-6.0d0))
    if (z <= (-470.0d0)) then
        tmp = t_1
    else if (z <= (-1.8d-137)) then
        tmp = t_0
    else if (z <= (-3.3d-255)) then
        tmp = x * ((-3.0d0) + (z * 6.0d0))
    else if (z <= 4.2d-264) then
        tmp = t_0
    else if (z <= 6.2d-115) then
        tmp = x * (-3.0d0)
    else if (z <= 170000.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 = y * (4.0 + (z * -6.0));
	double t_1 = z * ((y - x) * -6.0);
	double tmp;
	if (z <= -470.0) {
		tmp = t_1;
	} else if (z <= -1.8e-137) {
		tmp = t_0;
	} else if (z <= -3.3e-255) {
		tmp = x * (-3.0 + (z * 6.0));
	} else if (z <= 4.2e-264) {
		tmp = t_0;
	} else if (z <= 6.2e-115) {
		tmp = x * -3.0;
	} else if (z <= 170000.0) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = y * (4.0 + (z * -6.0))
	t_1 = z * ((y - x) * -6.0)
	tmp = 0
	if z <= -470.0:
		tmp = t_1
	elif z <= -1.8e-137:
		tmp = t_0
	elif z <= -3.3e-255:
		tmp = x * (-3.0 + (z * 6.0))
	elif z <= 4.2e-264:
		tmp = t_0
	elif z <= 6.2e-115:
		tmp = x * -3.0
	elif z <= 170000.0:
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(y * Float64(4.0 + Float64(z * -6.0)))
	t_1 = Float64(z * Float64(Float64(y - x) * -6.0))
	tmp = 0.0
	if (z <= -470.0)
		tmp = t_1;
	elseif (z <= -1.8e-137)
		tmp = t_0;
	elseif (z <= -3.3e-255)
		tmp = Float64(x * Float64(-3.0 + Float64(z * 6.0)));
	elseif (z <= 4.2e-264)
		tmp = t_0;
	elseif (z <= 6.2e-115)
		tmp = Float64(x * -3.0);
	elseif (z <= 170000.0)
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = y * (4.0 + (z * -6.0));
	t_1 = z * ((y - x) * -6.0);
	tmp = 0.0;
	if (z <= -470.0)
		tmp = t_1;
	elseif (z <= -1.8e-137)
		tmp = t_0;
	elseif (z <= -3.3e-255)
		tmp = x * (-3.0 + (z * 6.0));
	elseif (z <= 4.2e-264)
		tmp = t_0;
	elseif (z <= 6.2e-115)
		tmp = x * -3.0;
	elseif (z <= 170000.0)
		tmp = t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(4.0 + N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(z * N[(N[(y - x), $MachinePrecision] * -6.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -470.0], t$95$1, If[LessEqual[z, -1.8e-137], t$95$0, If[LessEqual[z, -3.3e-255], N[(x * N[(-3.0 + N[(z * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.2e-264], t$95$0, If[LessEqual[z, 6.2e-115], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 170000.0], t$95$0, t$95$1]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -1.8 \cdot 10^{-137}:\\
\;\;\;\;t\_0\\

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

\mathbf{elif}\;z \leq 4.2 \cdot 10^{-264}:\\
\;\;\;\;t\_0\\

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

\mathbf{elif}\;z \leq 170000:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -470 or 1.7e5 < z

    1. Initial program 99.7%

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

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

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

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

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

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

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

    if -470 < z < -1.80000000000000003e-137 or -3.29999999999999988e-255 < z < 4.2000000000000004e-264 or 6.20000000000000013e-115 < z < 1.7e5

    1. Initial program 98.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.80000000000000003e-137 < z < -3.29999999999999988e-255

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.2000000000000004e-264 < z < 6.20000000000000013e-115

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -470:\\ \;\;\;\;z \cdot \left(\left(y - x\right) \cdot -6\right)\\ \mathbf{elif}\;z \leq -1.8 \cdot 10^{-137}:\\ \;\;\;\;y \cdot \left(4 + z \cdot -6\right)\\ \mathbf{elif}\;z \leq -3.3 \cdot 10^{-255}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{elif}\;z \leq 4.2 \cdot 10^{-264}:\\ \;\;\;\;y \cdot \left(4 + z \cdot -6\right)\\ \mathbf{elif}\;z \leq 6.2 \cdot 10^{-115}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 170000:\\ \;\;\;\;y \cdot \left(4 + z \cdot -6\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(\left(y - x\right) \cdot -6\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 50.9% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -6 \cdot \left(y \cdot z\right)\\ \mathbf{if}\;z \leq -0.65:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -1.75 \cdot 10^{-128}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -2.8 \cdot 10^{-261}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 5.8 \cdot 10^{-265}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 2.15 \cdot 10^{-122}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 7 \cdot 10^{-7}:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* -6.0 (* y z))))
   (if (<= z -0.65)
     t_0
     (if (<= z -1.75e-128)
       (* y 4.0)
       (if (<= z -2.8e-261)
         (* x -3.0)
         (if (<= z 5.8e-265)
           (* y 4.0)
           (if (<= z 2.15e-122)
             (* x -3.0)
             (if (<= z 7e-7) (* y 4.0) t_0))))))))
double code(double x, double y, double z) {
	double t_0 = -6.0 * (y * z);
	double tmp;
	if (z <= -0.65) {
		tmp = t_0;
	} else if (z <= -1.75e-128) {
		tmp = y * 4.0;
	} else if (z <= -2.8e-261) {
		tmp = x * -3.0;
	} else if (z <= 5.8e-265) {
		tmp = y * 4.0;
	} else if (z <= 2.15e-122) {
		tmp = x * -3.0;
	} else if (z <= 7e-7) {
		tmp = y * 4.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 <= (-0.65d0)) then
        tmp = t_0
    else if (z <= (-1.75d-128)) then
        tmp = y * 4.0d0
    else if (z <= (-2.8d-261)) then
        tmp = x * (-3.0d0)
    else if (z <= 5.8d-265) then
        tmp = y * 4.0d0
    else if (z <= 2.15d-122) then
        tmp = x * (-3.0d0)
    else if (z <= 7d-7) then
        tmp = y * 4.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 <= -0.65) {
		tmp = t_0;
	} else if (z <= -1.75e-128) {
		tmp = y * 4.0;
	} else if (z <= -2.8e-261) {
		tmp = x * -3.0;
	} else if (z <= 5.8e-265) {
		tmp = y * 4.0;
	} else if (z <= 2.15e-122) {
		tmp = x * -3.0;
	} else if (z <= 7e-7) {
		tmp = y * 4.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = -6.0 * (y * z)
	tmp = 0
	if z <= -0.65:
		tmp = t_0
	elif z <= -1.75e-128:
		tmp = y * 4.0
	elif z <= -2.8e-261:
		tmp = x * -3.0
	elif z <= 5.8e-265:
		tmp = y * 4.0
	elif z <= 2.15e-122:
		tmp = x * -3.0
	elif z <= 7e-7:
		tmp = y * 4.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 <= -0.65)
		tmp = t_0;
	elseif (z <= -1.75e-128)
		tmp = Float64(y * 4.0);
	elseif (z <= -2.8e-261)
		tmp = Float64(x * -3.0);
	elseif (z <= 5.8e-265)
		tmp = Float64(y * 4.0);
	elseif (z <= 2.15e-122)
		tmp = Float64(x * -3.0);
	elseif (z <= 7e-7)
		tmp = Float64(y * 4.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 <= -0.65)
		tmp = t_0;
	elseif (z <= -1.75e-128)
		tmp = y * 4.0;
	elseif (z <= -2.8e-261)
		tmp = x * -3.0;
	elseif (z <= 5.8e-265)
		tmp = y * 4.0;
	elseif (z <= 2.15e-122)
		tmp = x * -3.0;
	elseif (z <= 7e-7)
		tmp = y * 4.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, -0.65], t$95$0, If[LessEqual[z, -1.75e-128], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, -2.8e-261], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 5.8e-265], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 2.15e-122], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 7e-7], N[(y * 4.0), $MachinePrecision], t$95$0]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -1.75 \cdot 10^{-128}:\\
\;\;\;\;y \cdot 4\\

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -0.650000000000000022 or 6.99999999999999968e-7 < z

    1. Initial program 99.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.650000000000000022 < z < -1.75e-128 or -2.80000000000000009e-261 < z < 5.7999999999999995e-265 or 2.15000000000000009e-122 < z < 6.99999999999999968e-7

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.75e-128 < z < -2.80000000000000009e-261 or 5.7999999999999995e-265 < z < 2.15000000000000009e-122

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 75.3% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -7 \cdot 10^{+44} \lor \neg \left(y \leq 4.8 \cdot 10^{-58} \lor \neg \left(y \leq 4.2 \cdot 10^{+107}\right) \land y \leq 9.2 \cdot 10^{+128}\right):\\ \;\;\;\;y \cdot \left(4 + z \cdot -6\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= y -7e+44)
         (not (or (<= y 4.8e-58) (and (not (<= y 4.2e+107)) (<= y 9.2e+128)))))
   (* y (+ 4.0 (* z -6.0)))
   (* x (+ -3.0 (* z 6.0)))))
double code(double x, double y, double z) {
	double tmp;
	if ((y <= -7e+44) || !((y <= 4.8e-58) || (!(y <= 4.2e+107) && (y <= 9.2e+128)))) {
		tmp = y * (4.0 + (z * -6.0));
	} else {
		tmp = x * (-3.0 + (z * 6.0));
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((y <= (-7d+44)) .or. (.not. (y <= 4.8d-58) .or. (.not. (y <= 4.2d+107)) .and. (y <= 9.2d+128))) then
        tmp = y * (4.0d0 + (z * (-6.0d0)))
    else
        tmp = x * ((-3.0d0) + (z * 6.0d0))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((y <= -7e+44) || !((y <= 4.8e-58) || (!(y <= 4.2e+107) && (y <= 9.2e+128)))) {
		tmp = y * (4.0 + (z * -6.0));
	} else {
		tmp = x * (-3.0 + (z * 6.0));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (y <= -7e+44) or not ((y <= 4.8e-58) or (not (y <= 4.2e+107) and (y <= 9.2e+128))):
		tmp = y * (4.0 + (z * -6.0))
	else:
		tmp = x * (-3.0 + (z * 6.0))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((y <= -7e+44) || !((y <= 4.8e-58) || (!(y <= 4.2e+107) && (y <= 9.2e+128))))
		tmp = Float64(y * Float64(4.0 + Float64(z * -6.0)));
	else
		tmp = Float64(x * Float64(-3.0 + Float64(z * 6.0)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((y <= -7e+44) || ~(((y <= 4.8e-58) || (~((y <= 4.2e+107)) && (y <= 9.2e+128)))))
		tmp = y * (4.0 + (z * -6.0));
	else
		tmp = x * (-3.0 + (z * 6.0));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[y, -7e+44], N[Not[Or[LessEqual[y, 4.8e-58], And[N[Not[LessEqual[y, 4.2e+107]], $MachinePrecision], LessEqual[y, 9.2e+128]]]], $MachinePrecision]], N[(y * N[(4.0 + N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(-3.0 + N[(z * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -7 \cdot 10^{+44} \lor \neg \left(y \leq 4.8 \cdot 10^{-58} \lor \neg \left(y \leq 4.2 \cdot 10^{+107}\right) \land y \leq 9.2 \cdot 10^{+128}\right):\\
\;\;\;\;y \cdot \left(4 + z \cdot -6\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -6.9999999999999998e44 or 4.8000000000000001e-58 < y < 4.1999999999999999e107 or 9.19999999999999992e128 < y

    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.8%

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

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

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

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

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

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

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

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

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

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

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

    if -6.9999999999999998e44 < y < 4.8000000000000001e-58 or 4.1999999999999999e107 < y < 9.19999999999999992e128

    1. Initial program 99.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -7 \cdot 10^{+44} \lor \neg \left(y \leq 4.8 \cdot 10^{-58} \lor \neg \left(y \leq 4.2 \cdot 10^{+107}\right) \land y \leq 9.2 \cdot 10^{+128}\right):\\ \;\;\;\;y \cdot \left(4 + z \cdot -6\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 59.5% accurate, 0.5× speedup?

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

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

\mathbf{elif}\;x \leq -2.6 \cdot 10^{-304}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 1.65 \cdot 10^{-235}:\\
\;\;\;\;y \cdot 4\\

\mathbf{elif}\;x \leq 8 \cdot 10^{-122}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.3999999999999999e-59 or 8.00000000000000047e-122 < x

    1. Initial program 99.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.3999999999999999e-59 < x < -2.59999999999999997e-304 or 1.65000000000000014e-235 < x < 8.00000000000000047e-122

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.59999999999999997e-304 < x < 1.65000000000000014e-235

    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-define100.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. distribute-rgt-in100.0%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.4 \cdot 10^{-59}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{elif}\;x \leq -2.6 \cdot 10^{-304}:\\ \;\;\;\;z \cdot \left(y \cdot -6\right)\\ \mathbf{elif}\;x \leq 1.65 \cdot 10^{-235}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;x \leq 8 \cdot 10^{-122}:\\ \;\;\;\;z \cdot \left(y \cdot -6\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 97.7% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

    if -0.57999999999999996 < z < 0.5

    1. Initial program 98.7%

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

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

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

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

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

Alternative 12: 99.7% accurate, 0.9× speedup?

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

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

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

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

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

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

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

Alternative 13: 38.2% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.9 \cdot 10^{-120} \lor \neg \left(y \leq 1.1 \cdot 10^{-57}\right):\\
\;\;\;\;y \cdot 4\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -5.89999999999999979e-120 or 1.09999999999999999e-57 < y

    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.8%

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.89999999999999979e-120 < y < 1.09999999999999999e-57

    1. Initial program 98.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 99.5% accurate, 1.2× speedup?

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

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

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

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

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

Alternative 15: 26.3% accurate, 4.3× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 16: 2.6% accurate, 13.0× speedup?

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

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

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

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

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

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

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

Reproduce

?
herbie shell --seed 2024085 
(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))))