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

Percentage Accurate: 99.7% → 99.8%
Time: 8.2s
Alternatives: 11
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ x + \left(\left(y - x\right) \cdot 6\right) \cdot z \end{array} \]
(FPCore (x y z) :precision binary64 (+ x (* (* (- y x) 6.0) z)))
double code(double x, double y, double z) {
	return x + (((y - x) * 6.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) * z)
end function
public static double code(double x, double y, double z) {
	return x + (((y - x) * 6.0) * z);
}
def code(x, y, z):
	return x + (((y - x) * 6.0) * z)
function code(x, y, z)
	return Float64(x + Float64(Float64(Float64(y - x) * 6.0) * z))
end
function tmp = code(x, y, z)
	tmp = x + (((y - x) * 6.0) * z);
end
code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x + \left(\left(y - x\right) \cdot 6\right) \cdot z
\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 11 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.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x + \left(\left(y - x\right) \cdot 6\right) \cdot z \end{array} \]
(FPCore (x y z) :precision binary64 (+ x (* (* (- y x) 6.0) z)))
double code(double x, double y, double z) {
	return x + (((y - x) * 6.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) * z)
end function
public static double code(double x, double y, double z) {
	return x + (((y - x) * 6.0) * z);
}
def code(x, y, z):
	return x + (((y - x) * 6.0) * z)
function code(x, y, z)
	return Float64(x + Float64(Float64(Float64(y - x) * 6.0) * z))
end
function tmp = code(x, y, z)
	tmp = x + (((y - x) * 6.0) * z);
end
code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Alternative 1: 99.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x + \left(y - x\right) \cdot \left(6 \cdot z\right) \end{array} \]
(FPCore (x y z) :precision binary64 (+ x (* (- y x) (* 6.0 z))))
double code(double x, double y, double z) {
	return x + ((y - x) * (6.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 * z))
end function
public static double code(double x, double y, double z) {
	return x + ((y - x) * (6.0 * z));
}
def code(x, y, z):
	return x + ((y - x) * (6.0 * z))
function code(x, y, z)
	return Float64(x + Float64(Float64(y - x) * Float64(6.0 * z)))
end
function tmp = code(x, y, z)
	tmp = x + ((y - x) * (6.0 * z));
end
code[x_, y_, z_] := N[(x + N[(N[(y - x), $MachinePrecision] * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

    \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
  2. Step-by-step derivation
    1. associate-*l*99.8%

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

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

Alternative 2: 58.4% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 6 \cdot \left(y \cdot z\right)\\ t_1 := 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 -470:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -4.2 \cdot 10^{-119}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 5.7 \cdot 10^{-86}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 5.2 \cdot 10^{-20}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 0.17:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 7.5 \cdot 10^{+49} \lor \neg \left(z \leq 2.15 \cdot 10^{+83}\right):\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* 6.0 (* y z))) (t_1 (* x (* z -6.0))))
   (if (<= z -3.3e+90)
     (* z (* y 6.0))
     (if (<= z -470.0)
       t_1
       (if (<= z -4.2e-119)
         t_0
         (if (<= z 5.7e-86)
           x
           (if (<= z 5.2e-20)
             t_0
             (if (<= z 0.17)
               x
               (if (or (<= z 7.5e+49) (not (<= z 2.15e+83))) t_1 t_0)))))))))
double code(double x, double y, double z) {
	double t_0 = 6.0 * (y * z);
	double t_1 = x * (z * -6.0);
	double tmp;
	if (z <= -3.3e+90) {
		tmp = z * (y * 6.0);
	} else if (z <= -470.0) {
		tmp = t_1;
	} else if (z <= -4.2e-119) {
		tmp = t_0;
	} else if (z <= 5.7e-86) {
		tmp = x;
	} else if (z <= 5.2e-20) {
		tmp = t_0;
	} else if (z <= 0.17) {
		tmp = x;
	} else if ((z <= 7.5e+49) || !(z <= 2.15e+83)) {
		tmp = t_1;
	} 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) :: t_1
    real(8) :: tmp
    t_0 = 6.0d0 * (y * z)
    t_1 = x * (z * (-6.0d0))
    if (z <= (-3.3d+90)) then
        tmp = z * (y * 6.0d0)
    else if (z <= (-470.0d0)) then
        tmp = t_1
    else if (z <= (-4.2d-119)) then
        tmp = t_0
    else if (z <= 5.7d-86) then
        tmp = x
    else if (z <= 5.2d-20) then
        tmp = t_0
    else if (z <= 0.17d0) then
        tmp = x
    else if ((z <= 7.5d+49) .or. (.not. (z <= 2.15d+83))) then
        tmp = t_1
    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 t_1 = x * (z * -6.0);
	double tmp;
	if (z <= -3.3e+90) {
		tmp = z * (y * 6.0);
	} else if (z <= -470.0) {
		tmp = t_1;
	} else if (z <= -4.2e-119) {
		tmp = t_0;
	} else if (z <= 5.7e-86) {
		tmp = x;
	} else if (z <= 5.2e-20) {
		tmp = t_0;
	} else if (z <= 0.17) {
		tmp = x;
	} else if ((z <= 7.5e+49) || !(z <= 2.15e+83)) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 6.0 * (y * z)
	t_1 = x * (z * -6.0)
	tmp = 0
	if z <= -3.3e+90:
		tmp = z * (y * 6.0)
	elif z <= -470.0:
		tmp = t_1
	elif z <= -4.2e-119:
		tmp = t_0
	elif z <= 5.7e-86:
		tmp = x
	elif z <= 5.2e-20:
		tmp = t_0
	elif z <= 0.17:
		tmp = x
	elif (z <= 7.5e+49) or not (z <= 2.15e+83):
		tmp = t_1
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(6.0 * Float64(y * z))
	t_1 = Float64(x * Float64(z * -6.0))
	tmp = 0.0
	if (z <= -3.3e+90)
		tmp = Float64(z * Float64(y * 6.0));
	elseif (z <= -470.0)
		tmp = t_1;
	elseif (z <= -4.2e-119)
		tmp = t_0;
	elseif (z <= 5.7e-86)
		tmp = x;
	elseif (z <= 5.2e-20)
		tmp = t_0;
	elseif (z <= 0.17)
		tmp = x;
	elseif ((z <= 7.5e+49) || !(z <= 2.15e+83))
		tmp = t_1;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 6.0 * (y * z);
	t_1 = x * (z * -6.0);
	tmp = 0.0;
	if (z <= -3.3e+90)
		tmp = z * (y * 6.0);
	elseif (z <= -470.0)
		tmp = t_1;
	elseif (z <= -4.2e-119)
		tmp = t_0;
	elseif (z <= 5.7e-86)
		tmp = x;
	elseif (z <= 5.2e-20)
		tmp = t_0;
	elseif (z <= 0.17)
		tmp = x;
	elseif ((z <= 7.5e+49) || ~((z <= 2.15e+83)))
		tmp = t_1;
	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]}, Block[{t$95$1 = 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, -470.0], t$95$1, If[LessEqual[z, -4.2e-119], t$95$0, If[LessEqual[z, 5.7e-86], x, If[LessEqual[z, 5.2e-20], t$95$0, If[LessEqual[z, 0.17], x, If[Or[LessEqual[z, 7.5e+49], N[Not[LessEqual[z, 2.15e+83]], $MachinePrecision]], t$95$1, t$95$0]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 6 \cdot \left(y \cdot z\right)\\
t_1 := 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 -470:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;z \leq 5.7 \cdot 10^{-86}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 5.2 \cdot 10^{-20}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq 0.17:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 7.5 \cdot 10^{+49} \lor \neg \left(z \leq 2.15 \cdot 10^{+83}\right):\\
\;\;\;\;t\_1\\

\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 z \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 66.8%

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

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

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

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

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

        \[\leadsto z \cdot \color{blue}{\mathsf{fma}\left(6, y, \frac{x}{z}\right)} \]
    8. Simplified66.9%

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

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

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

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

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

    if -3.30000000000000008e90 < z < -470 or 0.170000000000000012 < z < 7.4999999999999995e49 or 2.15e83 < z

    1. Initial program 99.7%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 65.0%

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

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

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

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

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

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

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

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

    if -470 < z < -4.2e-119 or 5.7000000000000004e-86 < z < 5.1999999999999999e-20 or 7.4999999999999995e49 < z < 2.15e83

    1. Initial program 99.7%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 97.4%

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

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

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

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

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

        \[\leadsto z \cdot \color{blue}{\mathsf{fma}\left(6, y, \frac{x}{z}\right)} \]
    8. Simplified88.7%

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

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

    if -4.2e-119 < z < 5.7000000000000004e-86 or 5.1999999999999999e-20 < z < 0.170000000000000012

    1. Initial program 98.6%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 89.0%

      \[\leadsto \color{blue}{x} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification71.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.3 \cdot 10^{+90}:\\ \;\;\;\;z \cdot \left(y \cdot 6\right)\\ \mathbf{elif}\;z \leq -470:\\ \;\;\;\;x \cdot \left(z \cdot -6\right)\\ \mathbf{elif}\;z \leq -4.2 \cdot 10^{-119}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 5.7 \cdot 10^{-86}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 5.2 \cdot 10^{-20}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 0.17:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 7.5 \cdot 10^{+49} \lor \neg \left(z \leq 2.15 \cdot 10^{+83}\right):\\ \;\;\;\;x \cdot \left(z \cdot -6\right)\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 58.4% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 6 \cdot \left(y \cdot z\right)\\ t_1 := x \cdot \left(z \cdot -6\right)\\ \mathbf{if}\;z \leq -3.4 \cdot 10^{+90}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -470:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -1.05 \cdot 10^{-119}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 5.7 \cdot 10^{-86}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.35 \cdot 10^{-19}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 0.17:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 2 \cdot 10^{+49} \lor \neg \left(z \leq 9.5 \cdot 10^{+78}\right):\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* 6.0 (* y z))) (t_1 (* x (* z -6.0))))
   (if (<= z -3.4e+90)
     t_0
     (if (<= z -470.0)
       t_1
       (if (<= z -1.05e-119)
         t_0
         (if (<= z 5.7e-86)
           x
           (if (<= z 1.35e-19)
             t_0
             (if (<= z 0.17)
               x
               (if (or (<= z 2e+49) (not (<= z 9.5e+78))) t_1 t_0)))))))))
double code(double x, double y, double z) {
	double t_0 = 6.0 * (y * z);
	double t_1 = x * (z * -6.0);
	double tmp;
	if (z <= -3.4e+90) {
		tmp = t_0;
	} else if (z <= -470.0) {
		tmp = t_1;
	} else if (z <= -1.05e-119) {
		tmp = t_0;
	} else if (z <= 5.7e-86) {
		tmp = x;
	} else if (z <= 1.35e-19) {
		tmp = t_0;
	} else if (z <= 0.17) {
		tmp = x;
	} else if ((z <= 2e+49) || !(z <= 9.5e+78)) {
		tmp = t_1;
	} 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) :: t_1
    real(8) :: tmp
    t_0 = 6.0d0 * (y * z)
    t_1 = x * (z * (-6.0d0))
    if (z <= (-3.4d+90)) then
        tmp = t_0
    else if (z <= (-470.0d0)) then
        tmp = t_1
    else if (z <= (-1.05d-119)) then
        tmp = t_0
    else if (z <= 5.7d-86) then
        tmp = x
    else if (z <= 1.35d-19) then
        tmp = t_0
    else if (z <= 0.17d0) then
        tmp = x
    else if ((z <= 2d+49) .or. (.not. (z <= 9.5d+78))) then
        tmp = t_1
    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 t_1 = x * (z * -6.0);
	double tmp;
	if (z <= -3.4e+90) {
		tmp = t_0;
	} else if (z <= -470.0) {
		tmp = t_1;
	} else if (z <= -1.05e-119) {
		tmp = t_0;
	} else if (z <= 5.7e-86) {
		tmp = x;
	} else if (z <= 1.35e-19) {
		tmp = t_0;
	} else if (z <= 0.17) {
		tmp = x;
	} else if ((z <= 2e+49) || !(z <= 9.5e+78)) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 6.0 * (y * z)
	t_1 = x * (z * -6.0)
	tmp = 0
	if z <= -3.4e+90:
		tmp = t_0
	elif z <= -470.0:
		tmp = t_1
	elif z <= -1.05e-119:
		tmp = t_0
	elif z <= 5.7e-86:
		tmp = x
	elif z <= 1.35e-19:
		tmp = t_0
	elif z <= 0.17:
		tmp = x
	elif (z <= 2e+49) or not (z <= 9.5e+78):
		tmp = t_1
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(6.0 * Float64(y * z))
	t_1 = Float64(x * Float64(z * -6.0))
	tmp = 0.0
	if (z <= -3.4e+90)
		tmp = t_0;
	elseif (z <= -470.0)
		tmp = t_1;
	elseif (z <= -1.05e-119)
		tmp = t_0;
	elseif (z <= 5.7e-86)
		tmp = x;
	elseif (z <= 1.35e-19)
		tmp = t_0;
	elseif (z <= 0.17)
		tmp = x;
	elseif ((z <= 2e+49) || !(z <= 9.5e+78))
		tmp = t_1;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 6.0 * (y * z);
	t_1 = x * (z * -6.0);
	tmp = 0.0;
	if (z <= -3.4e+90)
		tmp = t_0;
	elseif (z <= -470.0)
		tmp = t_1;
	elseif (z <= -1.05e-119)
		tmp = t_0;
	elseif (z <= 5.7e-86)
		tmp = x;
	elseif (z <= 1.35e-19)
		tmp = t_0;
	elseif (z <= 0.17)
		tmp = x;
	elseif ((z <= 2e+49) || ~((z <= 9.5e+78)))
		tmp = t_1;
	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]}, Block[{t$95$1 = N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.4e+90], t$95$0, If[LessEqual[z, -470.0], t$95$1, If[LessEqual[z, -1.05e-119], t$95$0, If[LessEqual[z, 5.7e-86], x, If[LessEqual[z, 1.35e-19], t$95$0, If[LessEqual[z, 0.17], x, If[Or[LessEqual[z, 2e+49], N[Not[LessEqual[z, 9.5e+78]], $MachinePrecision]], t$95$1, t$95$0]]]]]]]]]
\begin{array}{l}

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

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

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

\mathbf{elif}\;z \leq 5.7 \cdot 10^{-86}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 1.35 \cdot 10^{-19}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq 0.17:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 2 \cdot 10^{+49} \lor \neg \left(z \leq 9.5 \cdot 10^{+78}\right):\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -3.40000000000000018e90 or -470 < z < -1.05e-119 or 5.7000000000000004e-86 < z < 1.35e-19 or 1.99999999999999989e49 < z < 9.5000000000000006e78

    1. Initial program 99.7%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 80.6%

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

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

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

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

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

        \[\leadsto z \cdot \color{blue}{\mathsf{fma}\left(6, y, \frac{x}{z}\right)} \]
    8. Simplified76.7%

      \[\leadsto \color{blue}{z \cdot \mathsf{fma}\left(6, y, \frac{x}{z}\right)} \]
    9. Taylor expanded in z around inf 66.1%

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

    if -3.40000000000000018e90 < z < -470 or 0.170000000000000012 < z < 1.99999999999999989e49 or 9.5000000000000006e78 < z

    1. Initial program 99.7%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 65.0%

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

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

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

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

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

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

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

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

    if -1.05e-119 < z < 5.7000000000000004e-86 or 1.35e-19 < z < 0.170000000000000012

    1. Initial program 98.6%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 89.0%

      \[\leadsto \color{blue}{x} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification71.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.4 \cdot 10^{+90}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -470:\\ \;\;\;\;x \cdot \left(z \cdot -6\right)\\ \mathbf{elif}\;z \leq -1.05 \cdot 10^{-119}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 5.7 \cdot 10^{-86}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.35 \cdot 10^{-19}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 0.17:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 2 \cdot 10^{+49} \lor \neg \left(z \leq 9.5 \cdot 10^{+78}\right):\\ \;\;\;\;x \cdot \left(z \cdot -6\right)\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 59.6% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 6 \cdot \left(y \cdot z\right)\\ t_1 := -6 \cdot \left(x \cdot z\right)\\ \mathbf{if}\;z \leq -3.6 \cdot 10^{+90}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -470:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -4.2 \cdot 10^{-119}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 0.17:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 8.5 \cdot 10^{+48} \lor \neg \left(z \leq 1.4 \cdot 10^{+85}\right):\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* 6.0 (* y z))) (t_1 (* -6.0 (* x z))))
   (if (<= z -3.6e+90)
     t_0
     (if (<= z -470.0)
       t_1
       (if (<= z -4.2e-119)
         t_0
         (if (<= z 0.17)
           x
           (if (or (<= z 8.5e+48) (not (<= z 1.4e+85))) t_1 t_0)))))))
double code(double x, double y, double z) {
	double t_0 = 6.0 * (y * z);
	double t_1 = -6.0 * (x * z);
	double tmp;
	if (z <= -3.6e+90) {
		tmp = t_0;
	} else if (z <= -470.0) {
		tmp = t_1;
	} else if (z <= -4.2e-119) {
		tmp = t_0;
	} else if (z <= 0.17) {
		tmp = x;
	} else if ((z <= 8.5e+48) || !(z <= 1.4e+85)) {
		tmp = t_1;
	} 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) :: t_1
    real(8) :: tmp
    t_0 = 6.0d0 * (y * z)
    t_1 = (-6.0d0) * (x * z)
    if (z <= (-3.6d+90)) then
        tmp = t_0
    else if (z <= (-470.0d0)) then
        tmp = t_1
    else if (z <= (-4.2d-119)) then
        tmp = t_0
    else if (z <= 0.17d0) then
        tmp = x
    else if ((z <= 8.5d+48) .or. (.not. (z <= 1.4d+85))) then
        tmp = t_1
    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 t_1 = -6.0 * (x * z);
	double tmp;
	if (z <= -3.6e+90) {
		tmp = t_0;
	} else if (z <= -470.0) {
		tmp = t_1;
	} else if (z <= -4.2e-119) {
		tmp = t_0;
	} else if (z <= 0.17) {
		tmp = x;
	} else if ((z <= 8.5e+48) || !(z <= 1.4e+85)) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 6.0 * (y * z)
	t_1 = -6.0 * (x * z)
	tmp = 0
	if z <= -3.6e+90:
		tmp = t_0
	elif z <= -470.0:
		tmp = t_1
	elif z <= -4.2e-119:
		tmp = t_0
	elif z <= 0.17:
		tmp = x
	elif (z <= 8.5e+48) or not (z <= 1.4e+85):
		tmp = t_1
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(6.0 * Float64(y * z))
	t_1 = Float64(-6.0 * Float64(x * z))
	tmp = 0.0
	if (z <= -3.6e+90)
		tmp = t_0;
	elseif (z <= -470.0)
		tmp = t_1;
	elseif (z <= -4.2e-119)
		tmp = t_0;
	elseif (z <= 0.17)
		tmp = x;
	elseif ((z <= 8.5e+48) || !(z <= 1.4e+85))
		tmp = t_1;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 6.0 * (y * z);
	t_1 = -6.0 * (x * z);
	tmp = 0.0;
	if (z <= -3.6e+90)
		tmp = t_0;
	elseif (z <= -470.0)
		tmp = t_1;
	elseif (z <= -4.2e-119)
		tmp = t_0;
	elseif (z <= 0.17)
		tmp = x;
	elseif ((z <= 8.5e+48) || ~((z <= 1.4e+85)))
		tmp = t_1;
	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]}, Block[{t$95$1 = N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.6e+90], t$95$0, If[LessEqual[z, -470.0], t$95$1, If[LessEqual[z, -4.2e-119], t$95$0, If[LessEqual[z, 0.17], x, If[Or[LessEqual[z, 8.5e+48], N[Not[LessEqual[z, 1.4e+85]], $MachinePrecision]], t$95$1, t$95$0]]]]]]]
\begin{array}{l}

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

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

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

\mathbf{elif}\;z \leq 0.17:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 8.5 \cdot 10^{+48} \lor \neg \left(z \leq 1.4 \cdot 10^{+85}\right):\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -3.6e90 or -470 < z < -4.2e-119 or 8.5000000000000001e48 < z < 1.4e85

    1. Initial program 99.8%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 77.0%

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

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

        \[\leadsto x + \color{blue}{y \cdot \left(z \cdot 6\right)} \]
    5. Simplified76.9%

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

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

        \[\leadsto z \cdot \color{blue}{\mathsf{fma}\left(6, y, \frac{x}{z}\right)} \]
    8. Simplified74.6%

      \[\leadsto \color{blue}{z \cdot \mathsf{fma}\left(6, y, \frac{x}{z}\right)} \]
    9. Taylor expanded in z around inf 66.7%

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

    if -3.6e90 < z < -470 or 0.170000000000000012 < z < 8.5000000000000001e48 or 1.4e85 < z

    1. Initial program 99.7%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 65.0%

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

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

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

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

    if -4.2e-119 < z < 0.170000000000000012

    1. Initial program 98.8%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 80.1%

      \[\leadsto \color{blue}{x} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification69.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.6 \cdot 10^{+90}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -470:\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -4.2 \cdot 10^{-119}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 0.17:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 8.5 \cdot 10^{+48} \lor \neg \left(z \leq 1.4 \cdot 10^{+85}\right):\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 75.6% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(z \cdot -6 + 1\right)\\ \mathbf{if}\;x \leq -6.4 \cdot 10^{-28}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 2.8 \cdot 10^{-122}:\\ \;\;\;\;z \cdot \left(y \cdot 6\right)\\ \mathbf{elif}\;x \leq 9 \cdot 10^{-74} \lor \neg \left(x \leq 7.6 \cdot 10^{-50}\right):\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* x (+ (* z -6.0) 1.0))))
   (if (<= x -6.4e-28)
     t_0
     (if (<= x 2.8e-122)
       (* z (* y 6.0))
       (if (or (<= x 9e-74) (not (<= x 7.6e-50))) t_0 (* 6.0 (* y z)))))))
double code(double x, double y, double z) {
	double t_0 = x * ((z * -6.0) + 1.0);
	double tmp;
	if (x <= -6.4e-28) {
		tmp = t_0;
	} else if (x <= 2.8e-122) {
		tmp = z * (y * 6.0);
	} else if ((x <= 9e-74) || !(x <= 7.6e-50)) {
		tmp = t_0;
	} else {
		tmp = 6.0 * (y * z);
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = x * ((z * (-6.0d0)) + 1.0d0)
    if (x <= (-6.4d-28)) then
        tmp = t_0
    else if (x <= 2.8d-122) then
        tmp = z * (y * 6.0d0)
    else if ((x <= 9d-74) .or. (.not. (x <= 7.6d-50))) then
        tmp = t_0
    else
        tmp = 6.0d0 * (y * z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = x * ((z * -6.0) + 1.0);
	double tmp;
	if (x <= -6.4e-28) {
		tmp = t_0;
	} else if (x <= 2.8e-122) {
		tmp = z * (y * 6.0);
	} else if ((x <= 9e-74) || !(x <= 7.6e-50)) {
		tmp = t_0;
	} else {
		tmp = 6.0 * (y * z);
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x * ((z * -6.0) + 1.0)
	tmp = 0
	if x <= -6.4e-28:
		tmp = t_0
	elif x <= 2.8e-122:
		tmp = z * (y * 6.0)
	elif (x <= 9e-74) or not (x <= 7.6e-50):
		tmp = t_0
	else:
		tmp = 6.0 * (y * z)
	return tmp
function code(x, y, z)
	t_0 = Float64(x * Float64(Float64(z * -6.0) + 1.0))
	tmp = 0.0
	if (x <= -6.4e-28)
		tmp = t_0;
	elseif (x <= 2.8e-122)
		tmp = Float64(z * Float64(y * 6.0));
	elseif ((x <= 9e-74) || !(x <= 7.6e-50))
		tmp = t_0;
	else
		tmp = Float64(6.0 * Float64(y * z));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x * ((z * -6.0) + 1.0);
	tmp = 0.0;
	if (x <= -6.4e-28)
		tmp = t_0;
	elseif (x <= 2.8e-122)
		tmp = z * (y * 6.0);
	elseif ((x <= 9e-74) || ~((x <= 7.6e-50)))
		tmp = t_0;
	else
		tmp = 6.0 * (y * z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(N[(z * -6.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6.4e-28], t$95$0, If[LessEqual[x, 2.8e-122], N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, 9e-74], N[Not[LessEqual[x, 7.6e-50]], $MachinePrecision]], t$95$0, N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x \cdot \left(z \cdot -6 + 1\right)\\
\mathbf{if}\;x \leq -6.4 \cdot 10^{-28}:\\
\;\;\;\;t\_0\\

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

\mathbf{elif}\;x \leq 9 \cdot 10^{-74} \lor \neg \left(x \leq 7.6 \cdot 10^{-50}\right):\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -6.39999999999999964e-28 or 2.7999999999999999e-122 < x < 8.9999999999999998e-74 or 7.5999999999999998e-50 < x

    1. Initial program 99.2%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 84.7%

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

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

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

    if -6.39999999999999964e-28 < x < 2.7999999999999999e-122

    1. Initial program 99.7%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 91.3%

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

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

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

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

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

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

      \[\leadsto \color{blue}{z \cdot \mathsf{fma}\left(6, y, \frac{x}{z}\right)} \]
    9. Taylor expanded in z around inf 71.9%

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

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

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

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

    if 8.9999999999999998e-74 < x < 7.5999999999999998e-50

    1. Initial program 99.1%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 87.1%

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

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

        \[\leadsto x + \color{blue}{y \cdot \left(z \cdot 6\right)} \]
    5. Simplified87.1%

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

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

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

      \[\leadsto \color{blue}{z \cdot \mathsf{fma}\left(6, y, \frac{x}{z}\right)} \]
    9. Taylor expanded in z around inf 86.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -6.4 \cdot 10^{-28}:\\ \;\;\;\;x \cdot \left(z \cdot -6 + 1\right)\\ \mathbf{elif}\;x \leq 2.8 \cdot 10^{-122}:\\ \;\;\;\;z \cdot \left(y \cdot 6\right)\\ \mathbf{elif}\;x \leq 9 \cdot 10^{-74} \lor \neg \left(x \leq 7.6 \cdot 10^{-50}\right):\\ \;\;\;\;x \cdot \left(z \cdot -6 + 1\right)\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 75.6% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(z \cdot -6 + 1\right)\\ \mathbf{if}\;x \leq -1.8 \cdot 10^{-28}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 2.3 \cdot 10^{-121}:\\ \;\;\;\;z \cdot \left(y \cdot 6\right)\\ \mathbf{elif}\;x \leq 2.3 \cdot 10^{-75}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 6.3 \cdot 10^{-52}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* x (+ (* z -6.0) 1.0))))
   (if (<= x -1.8e-28)
     t_0
     (if (<= x 2.3e-121)
       (* z (* y 6.0))
       (if (<= x 2.3e-75)
         t_0
         (if (<= x 6.3e-52) (* 6.0 (* y z)) (+ x (* -6.0 (* x z)))))))))
double code(double x, double y, double z) {
	double t_0 = x * ((z * -6.0) + 1.0);
	double tmp;
	if (x <= -1.8e-28) {
		tmp = t_0;
	} else if (x <= 2.3e-121) {
		tmp = z * (y * 6.0);
	} else if (x <= 2.3e-75) {
		tmp = t_0;
	} else if (x <= 6.3e-52) {
		tmp = 6.0 * (y * z);
	} else {
		tmp = x + (-6.0 * (x * z));
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = x * ((z * (-6.0d0)) + 1.0d0)
    if (x <= (-1.8d-28)) then
        tmp = t_0
    else if (x <= 2.3d-121) then
        tmp = z * (y * 6.0d0)
    else if (x <= 2.3d-75) then
        tmp = t_0
    else if (x <= 6.3d-52) then
        tmp = 6.0d0 * (y * z)
    else
        tmp = x + ((-6.0d0) * (x * z))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = x * ((z * -6.0) + 1.0);
	double tmp;
	if (x <= -1.8e-28) {
		tmp = t_0;
	} else if (x <= 2.3e-121) {
		tmp = z * (y * 6.0);
	} else if (x <= 2.3e-75) {
		tmp = t_0;
	} else if (x <= 6.3e-52) {
		tmp = 6.0 * (y * z);
	} else {
		tmp = x + (-6.0 * (x * z));
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x * ((z * -6.0) + 1.0)
	tmp = 0
	if x <= -1.8e-28:
		tmp = t_0
	elif x <= 2.3e-121:
		tmp = z * (y * 6.0)
	elif x <= 2.3e-75:
		tmp = t_0
	elif x <= 6.3e-52:
		tmp = 6.0 * (y * z)
	else:
		tmp = x + (-6.0 * (x * z))
	return tmp
function code(x, y, z)
	t_0 = Float64(x * Float64(Float64(z * -6.0) + 1.0))
	tmp = 0.0
	if (x <= -1.8e-28)
		tmp = t_0;
	elseif (x <= 2.3e-121)
		tmp = Float64(z * Float64(y * 6.0));
	elseif (x <= 2.3e-75)
		tmp = t_0;
	elseif (x <= 6.3e-52)
		tmp = Float64(6.0 * Float64(y * z));
	else
		tmp = Float64(x + Float64(-6.0 * Float64(x * z)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x * ((z * -6.0) + 1.0);
	tmp = 0.0;
	if (x <= -1.8e-28)
		tmp = t_0;
	elseif (x <= 2.3e-121)
		tmp = z * (y * 6.0);
	elseif (x <= 2.3e-75)
		tmp = t_0;
	elseif (x <= 6.3e-52)
		tmp = 6.0 * (y * z);
	else
		tmp = x + (-6.0 * (x * z));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(N[(z * -6.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.8e-28], t$95$0, If[LessEqual[x, 2.3e-121], N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.3e-75], t$95$0, If[LessEqual[x, 6.3e-52], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], N[(x + N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x \cdot \left(z \cdot -6 + 1\right)\\
\mathbf{if}\;x \leq -1.8 \cdot 10^{-28}:\\
\;\;\;\;t\_0\\

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

\mathbf{elif}\;x \leq 2.3 \cdot 10^{-75}:\\
\;\;\;\;t\_0\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -1.7999999999999999e-28 or 2.30000000000000012e-121 < x < 2.3e-75

    1. Initial program 98.6%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 83.2%

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

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

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

    if -1.7999999999999999e-28 < x < 2.30000000000000012e-121

    1. Initial program 99.7%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 91.3%

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

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

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

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

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

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

      \[\leadsto \color{blue}{z \cdot \mathsf{fma}\left(6, y, \frac{x}{z}\right)} \]
    9. Taylor expanded in z around inf 71.9%

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

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

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

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

    if 2.3e-75 < x < 6.3000000000000003e-52

    1. Initial program 99.1%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 87.1%

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

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

        \[\leadsto x + \color{blue}{y \cdot \left(z \cdot 6\right)} \]
    5. Simplified87.1%

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

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

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

      \[\leadsto \color{blue}{z \cdot \mathsf{fma}\left(6, y, \frac{x}{z}\right)} \]
    9. Taylor expanded in z around inf 86.5%

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

    if 6.3000000000000003e-52 < x

    1. Initial program 99.9%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 86.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.8 \cdot 10^{-28}:\\ \;\;\;\;x \cdot \left(z \cdot -6 + 1\right)\\ \mathbf{elif}\;x \leq 2.3 \cdot 10^{-121}:\\ \;\;\;\;z \cdot \left(y \cdot 6\right)\\ \mathbf{elif}\;x \leq 2.3 \cdot 10^{-75}:\\ \;\;\;\;x \cdot \left(z \cdot -6 + 1\right)\\ \mathbf{elif}\;x \leq 6.3 \cdot 10^{-52}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 87.4% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.2 \cdot 10^{-16} \lor \neg \left(y \leq 2.8 \cdot 10^{-77}\right):\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.20000000000000023e-16 or 2.7999999999999999e-77 < y

    1. Initial program 99.8%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 88.5%

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

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

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

    if -3.20000000000000023e-16 < y < 2.7999999999999999e-77

    1. Initial program 98.9%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 88.2%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.2 \cdot 10^{-16} \lor \neg \left(y \leq 2.8 \cdot 10^{-77}\right):\\ \;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(z \cdot -6 + 1\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 87.3% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.35 \cdot 10^{-16}:\\ \;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{-76}:\\ \;\;\;\;x \cdot \left(z \cdot -6 + 1\right)\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \left(6 \cdot z\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y -1.35e-16)
   (+ x (* 6.0 (* y z)))
   (if (<= y 1.2e-76) (* x (+ (* z -6.0) 1.0)) (+ x (* y (* 6.0 z))))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -1.35e-16) {
		tmp = x + (6.0 * (y * z));
	} else if (y <= 1.2e-76) {
		tmp = x * ((z * -6.0) + 1.0);
	} else {
		tmp = x + (y * (6.0 * z));
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (y <= (-1.35d-16)) then
        tmp = x + (6.0d0 * (y * z))
    else if (y <= 1.2d-76) then
        tmp = x * ((z * (-6.0d0)) + 1.0d0)
    else
        tmp = x + (y * (6.0d0 * z))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (y <= -1.35e-16) {
		tmp = x + (6.0 * (y * z));
	} else if (y <= 1.2e-76) {
		tmp = x * ((z * -6.0) + 1.0);
	} else {
		tmp = x + (y * (6.0 * z));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= -1.35e-16:
		tmp = x + (6.0 * (y * z))
	elif y <= 1.2e-76:
		tmp = x * ((z * -6.0) + 1.0)
	else:
		tmp = x + (y * (6.0 * z))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= -1.35e-16)
		tmp = Float64(x + Float64(6.0 * Float64(y * z)));
	elseif (y <= 1.2e-76)
		tmp = Float64(x * Float64(Float64(z * -6.0) + 1.0));
	else
		tmp = Float64(x + Float64(y * Float64(6.0 * z)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= -1.35e-16)
		tmp = x + (6.0 * (y * z));
	elseif (y <= 1.2e-76)
		tmp = x * ((z * -6.0) + 1.0);
	else
		tmp = x + (y * (6.0 * z));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, -1.35e-16], N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.2e-76], N[(x * N[(N[(z * -6.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq 1.2 \cdot 10^{-76}:\\
\;\;\;\;x \cdot \left(z \cdot -6 + 1\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.35e-16

    1. Initial program 99.7%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 87.6%

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

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

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

    if -1.35e-16 < y < 1.20000000000000007e-76

    1. Initial program 98.9%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 88.2%

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

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

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

    if 1.20000000000000007e-76 < y

    1. Initial program 99.9%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 89.4%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.35 \cdot 10^{-16}:\\ \;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{-76}:\\ \;\;\;\;x \cdot \left(z \cdot -6 + 1\right)\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \left(6 \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 60.5% accurate, 0.6× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;x\\


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

    1. Initial program 99.8%

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

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

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

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

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

    if -0.165000000000000008 < z < 0.170000000000000012

    1. Initial program 98.9%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 72.5%

      \[\leadsto \color{blue}{x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification60.8%

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

Alternative 10: 99.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x + z \cdot \left(\left(y - x\right) \cdot 6\right) \end{array} \]
(FPCore (x y z) :precision binary64 (+ x (* z (* (- y x) 6.0))))
double code(double x, double y, double z) {
	return x + (z * ((y - x) * 6.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 + (z * ((y - x) * 6.0d0))
end function
public static double code(double x, double y, double z) {
	return x + (z * ((y - x) * 6.0));
}
def code(x, y, z):
	return x + (z * ((y - x) * 6.0))
function code(x, y, z)
	return Float64(x + Float64(z * Float64(Float64(y - x) * 6.0)))
end
function tmp = code(x, y, z)
	tmp = x + (z * ((y - x) * 6.0));
end
code[x_, y_, z_] := N[(x + N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

    \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
  2. Add Preprocessing
  3. Final simplification99.4%

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

Alternative 11: 37.2% accurate, 9.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.4%

    \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
  2. Add Preprocessing
  3. Taylor expanded in z around 0 32.4%

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

Developer target: 99.8% accurate, 1.0× speedup?

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

\\
x - \left(6 \cdot z\right) \cdot \left(x - y\right)
\end{array}

Reproduce

?
herbie shell --seed 2024085 
(FPCore (x y z)
  :name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, E"
  :precision binary64

  :alt
  (- x (* (* 6.0 z) (- x y)))

  (+ x (* (* (- y x) 6.0) z)))