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

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

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

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

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

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

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

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

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

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

Alternative 2: 61.1% accurate, 0.2× 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 -4.8 \cdot 10^{+125}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -1.35 \cdot 10^{+95}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -3 \cdot 10^{+70}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -5.8:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -2.55 \cdot 10^{-6}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{-69}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 6.2 \cdot 10^{+23} \lor \neg \left(z \leq 1.1 \cdot 10^{+127}\right) \land z \leq 2.6 \cdot 10^{+188}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* 6.0 (* y z))) (t_1 (* -6.0 (* x z))))
   (if (<= z -4.8e+125)
     t_0
     (if (<= z -1.35e+95)
       t_1
       (if (<= z -3e+70)
         t_0
         (if (<= z -5.8)
           t_1
           (if (<= z -2.55e-6)
             t_0
             (if (<= z 1.8e-69)
               x
               (if (or (<= z 6.2e+23)
                       (and (not (<= z 1.1e+127)) (<= z 2.6e+188)))
                 t_0
                 t_1)))))))))
double code(double x, double y, double z) {
	double t_0 = 6.0 * (y * z);
	double t_1 = -6.0 * (x * z);
	double tmp;
	if (z <= -4.8e+125) {
		tmp = t_0;
	} else if (z <= -1.35e+95) {
		tmp = t_1;
	} else if (z <= -3e+70) {
		tmp = t_0;
	} else if (z <= -5.8) {
		tmp = t_1;
	} else if (z <= -2.55e-6) {
		tmp = t_0;
	} else if (z <= 1.8e-69) {
		tmp = x;
	} else if ((z <= 6.2e+23) || (!(z <= 1.1e+127) && (z <= 2.6e+188))) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = 6.0d0 * (y * z)
    t_1 = (-6.0d0) * (x * z)
    if (z <= (-4.8d+125)) then
        tmp = t_0
    else if (z <= (-1.35d+95)) then
        tmp = t_1
    else if (z <= (-3d+70)) then
        tmp = t_0
    else if (z <= (-5.8d0)) then
        tmp = t_1
    else if (z <= (-2.55d-6)) then
        tmp = t_0
    else if (z <= 1.8d-69) then
        tmp = x
    else if ((z <= 6.2d+23) .or. (.not. (z <= 1.1d+127)) .and. (z <= 2.6d+188)) then
        tmp = t_0
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = 6.0 * (y * z);
	double t_1 = -6.0 * (x * z);
	double tmp;
	if (z <= -4.8e+125) {
		tmp = t_0;
	} else if (z <= -1.35e+95) {
		tmp = t_1;
	} else if (z <= -3e+70) {
		tmp = t_0;
	} else if (z <= -5.8) {
		tmp = t_1;
	} else if (z <= -2.55e-6) {
		tmp = t_0;
	} else if (z <= 1.8e-69) {
		tmp = x;
	} else if ((z <= 6.2e+23) || (!(z <= 1.1e+127) && (z <= 2.6e+188))) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 6.0 * (y * z)
	t_1 = -6.0 * (x * z)
	tmp = 0
	if z <= -4.8e+125:
		tmp = t_0
	elif z <= -1.35e+95:
		tmp = t_1
	elif z <= -3e+70:
		tmp = t_0
	elif z <= -5.8:
		tmp = t_1
	elif z <= -2.55e-6:
		tmp = t_0
	elif z <= 1.8e-69:
		tmp = x
	elif (z <= 6.2e+23) or (not (z <= 1.1e+127) and (z <= 2.6e+188)):
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(6.0 * Float64(y * z))
	t_1 = Float64(-6.0 * Float64(x * z))
	tmp = 0.0
	if (z <= -4.8e+125)
		tmp = t_0;
	elseif (z <= -1.35e+95)
		tmp = t_1;
	elseif (z <= -3e+70)
		tmp = t_0;
	elseif (z <= -5.8)
		tmp = t_1;
	elseif (z <= -2.55e-6)
		tmp = t_0;
	elseif (z <= 1.8e-69)
		tmp = x;
	elseif ((z <= 6.2e+23) || (!(z <= 1.1e+127) && (z <= 2.6e+188)))
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 6.0 * (y * z);
	t_1 = -6.0 * (x * z);
	tmp = 0.0;
	if (z <= -4.8e+125)
		tmp = t_0;
	elseif (z <= -1.35e+95)
		tmp = t_1;
	elseif (z <= -3e+70)
		tmp = t_0;
	elseif (z <= -5.8)
		tmp = t_1;
	elseif (z <= -2.55e-6)
		tmp = t_0;
	elseif (z <= 1.8e-69)
		tmp = x;
	elseif ((z <= 6.2e+23) || (~((z <= 1.1e+127)) && (z <= 2.6e+188)))
		tmp = t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.8e+125], t$95$0, If[LessEqual[z, -1.35e+95], t$95$1, If[LessEqual[z, -3e+70], t$95$0, If[LessEqual[z, -5.8], t$95$1, If[LessEqual[z, -2.55e-6], t$95$0, If[LessEqual[z, 1.8e-69], x, If[Or[LessEqual[z, 6.2e+23], And[N[Not[LessEqual[z, 1.1e+127]], $MachinePrecision], LessEqual[z, 2.6e+188]]], t$95$0, t$95$1]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -1.35 \cdot 10^{+95}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq -3 \cdot 10^{+70}:\\
\;\;\;\;t\_0\\

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

\mathbf{elif}\;z \leq -2.55 \cdot 10^{-6}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq 1.8 \cdot 10^{-69}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 6.2 \cdot 10^{+23} \lor \neg \left(z \leq 1.1 \cdot 10^{+127}\right) \land z \leq 2.6 \cdot 10^{+188}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -4.7999999999999999e125 or -1.35e95 < z < -2.99999999999999976e70 or -5.79999999999999982 < z < -2.5500000000000001e-6 or 1.80000000000000009e-69 < z < 6.19999999999999941e23 or 1.1000000000000001e127 < z < 2.59999999999999987e188

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

    if -4.7999999999999999e125 < z < -1.35e95 or -2.99999999999999976e70 < z < -5.79999999999999982 or 6.19999999999999941e23 < z < 1.1000000000000001e127 or 2.59999999999999987e188 < z

    1. Initial program 99.6%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r*99.7%

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left(y - x\right) \cdot z, 6, x\right)} \]
    4. Applied egg-rr99.6%

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

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

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

    if -2.5500000000000001e-6 < z < 1.80000000000000009e-69

    1. Initial program 99.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4.8 \cdot 10^{+125}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -1.35 \cdot 10^{+95}:\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -3 \cdot 10^{+70}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -5.8:\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -2.55 \cdot 10^{-6}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{-69}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 6.2 \cdot 10^{+23} \lor \neg \left(z \leq 1.1 \cdot 10^{+127}\right) \land z \leq 2.6 \cdot 10^{+188}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 61.1% accurate, 0.2× 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)\\ t_2 := x \cdot \left(z \cdot -6\right)\\ \mathbf{if}\;z \leq -5.5 \cdot 10^{+125}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -6.6 \cdot 10^{+96}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;z \leq -3 \cdot 10^{+70}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -5.8:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -2.55 \cdot 10^{-6}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 6.5 \cdot 10^{-69}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 8.8 \cdot 10^{+23}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 4.1 \cdot 10^{+132}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 3.7 \cdot 10^{+189}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* 6.0 (* y z))) (t_1 (* -6.0 (* x z))) (t_2 (* x (* z -6.0))))
   (if (<= z -5.5e+125)
     t_0
     (if (<= z -6.6e+96)
       t_2
       (if (<= z -3e+70)
         t_0
         (if (<= z -5.8)
           t_1
           (if (<= z -2.55e-6)
             t_0
             (if (<= z 6.5e-69)
               x
               (if (<= z 8.8e+23)
                 t_0
                 (if (<= z 4.1e+132) t_1 (if (<= z 3.7e+189) t_0 t_2)))))))))))
double code(double x, double y, double z) {
	double t_0 = 6.0 * (y * z);
	double t_1 = -6.0 * (x * z);
	double t_2 = x * (z * -6.0);
	double tmp;
	if (z <= -5.5e+125) {
		tmp = t_0;
	} else if (z <= -6.6e+96) {
		tmp = t_2;
	} else if (z <= -3e+70) {
		tmp = t_0;
	} else if (z <= -5.8) {
		tmp = t_1;
	} else if (z <= -2.55e-6) {
		tmp = t_0;
	} else if (z <= 6.5e-69) {
		tmp = x;
	} else if (z <= 8.8e+23) {
		tmp = t_0;
	} else if (z <= 4.1e+132) {
		tmp = t_1;
	} else if (z <= 3.7e+189) {
		tmp = t_0;
	} else {
		tmp = t_2;
	}
	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) :: t_2
    real(8) :: tmp
    t_0 = 6.0d0 * (y * z)
    t_1 = (-6.0d0) * (x * z)
    t_2 = x * (z * (-6.0d0))
    if (z <= (-5.5d+125)) then
        tmp = t_0
    else if (z <= (-6.6d+96)) then
        tmp = t_2
    else if (z <= (-3d+70)) then
        tmp = t_0
    else if (z <= (-5.8d0)) then
        tmp = t_1
    else if (z <= (-2.55d-6)) then
        tmp = t_0
    else if (z <= 6.5d-69) then
        tmp = x
    else if (z <= 8.8d+23) then
        tmp = t_0
    else if (z <= 4.1d+132) then
        tmp = t_1
    else if (z <= 3.7d+189) then
        tmp = t_0
    else
        tmp = t_2
    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 t_2 = x * (z * -6.0);
	double tmp;
	if (z <= -5.5e+125) {
		tmp = t_0;
	} else if (z <= -6.6e+96) {
		tmp = t_2;
	} else if (z <= -3e+70) {
		tmp = t_0;
	} else if (z <= -5.8) {
		tmp = t_1;
	} else if (z <= -2.55e-6) {
		tmp = t_0;
	} else if (z <= 6.5e-69) {
		tmp = x;
	} else if (z <= 8.8e+23) {
		tmp = t_0;
	} else if (z <= 4.1e+132) {
		tmp = t_1;
	} else if (z <= 3.7e+189) {
		tmp = t_0;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 6.0 * (y * z)
	t_1 = -6.0 * (x * z)
	t_2 = x * (z * -6.0)
	tmp = 0
	if z <= -5.5e+125:
		tmp = t_0
	elif z <= -6.6e+96:
		tmp = t_2
	elif z <= -3e+70:
		tmp = t_0
	elif z <= -5.8:
		tmp = t_1
	elif z <= -2.55e-6:
		tmp = t_0
	elif z <= 6.5e-69:
		tmp = x
	elif z <= 8.8e+23:
		tmp = t_0
	elif z <= 4.1e+132:
		tmp = t_1
	elif z <= 3.7e+189:
		tmp = t_0
	else:
		tmp = t_2
	return tmp
function code(x, y, z)
	t_0 = Float64(6.0 * Float64(y * z))
	t_1 = Float64(-6.0 * Float64(x * z))
	t_2 = Float64(x * Float64(z * -6.0))
	tmp = 0.0
	if (z <= -5.5e+125)
		tmp = t_0;
	elseif (z <= -6.6e+96)
		tmp = t_2;
	elseif (z <= -3e+70)
		tmp = t_0;
	elseif (z <= -5.8)
		tmp = t_1;
	elseif (z <= -2.55e-6)
		tmp = t_0;
	elseif (z <= 6.5e-69)
		tmp = x;
	elseif (z <= 8.8e+23)
		tmp = t_0;
	elseif (z <= 4.1e+132)
		tmp = t_1;
	elseif (z <= 3.7e+189)
		tmp = t_0;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 6.0 * (y * z);
	t_1 = -6.0 * (x * z);
	t_2 = x * (z * -6.0);
	tmp = 0.0;
	if (z <= -5.5e+125)
		tmp = t_0;
	elseif (z <= -6.6e+96)
		tmp = t_2;
	elseif (z <= -3e+70)
		tmp = t_0;
	elseif (z <= -5.8)
		tmp = t_1;
	elseif (z <= -2.55e-6)
		tmp = t_0;
	elseif (z <= 6.5e-69)
		tmp = x;
	elseif (z <= 8.8e+23)
		tmp = t_0;
	elseif (z <= 4.1e+132)
		tmp = t_1;
	elseif (z <= 3.7e+189)
		tmp = t_0;
	else
		tmp = t_2;
	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]}, Block[{t$95$2 = N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5.5e+125], t$95$0, If[LessEqual[z, -6.6e+96], t$95$2, If[LessEqual[z, -3e+70], t$95$0, If[LessEqual[z, -5.8], t$95$1, If[LessEqual[z, -2.55e-6], t$95$0, If[LessEqual[z, 6.5e-69], x, If[LessEqual[z, 8.8e+23], t$95$0, If[LessEqual[z, 4.1e+132], t$95$1, If[LessEqual[z, 3.7e+189], t$95$0, t$95$2]]]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -6.6 \cdot 10^{+96}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;z \leq -3 \cdot 10^{+70}:\\
\;\;\;\;t\_0\\

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

\mathbf{elif}\;z \leq -2.55 \cdot 10^{-6}:\\
\;\;\;\;t\_0\\

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

\mathbf{elif}\;z \leq 8.8 \cdot 10^{+23}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq 4.1 \cdot 10^{+132}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 3.7 \cdot 10^{+189}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -5.49999999999999996e125 or -6.59999999999999969e96 < z < -2.99999999999999976e70 or -5.79999999999999982 < z < -2.5500000000000001e-6 or 6.49999999999999951e-69 < z < 8.80000000000000034e23 or 4.09999999999999992e132 < z < 3.70000000000000021e189

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

    if -5.49999999999999996e125 < z < -6.59999999999999969e96 or 3.70000000000000021e189 < z

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.99999999999999976e70 < z < -5.79999999999999982 or 8.80000000000000034e23 < z < 4.09999999999999992e132

    1. Initial program 99.3%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r*99.6%

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left(y - x\right) \cdot z, 6, x\right)} \]
    4. Applied egg-rr99.4%

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

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

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

    if -2.5500000000000001e-6 < z < 6.49999999999999951e-69

    1. Initial program 99.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5.5 \cdot 10^{+125}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -6.6 \cdot 10^{+96}:\\ \;\;\;\;x \cdot \left(z \cdot -6\right)\\ \mathbf{elif}\;z \leq -3 \cdot 10^{+70}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -5.8:\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -2.55 \cdot 10^{-6}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 6.5 \cdot 10^{-69}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 8.8 \cdot 10^{+23}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 4.1 \cdot 10^{+132}:\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq 3.7 \cdot 10^{+189}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(z \cdot -6\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 61.1% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y \cdot \left(6 \cdot z\right)\\ t_1 := 6 \cdot \left(y \cdot z\right)\\ t_2 := -6 \cdot \left(x \cdot z\right)\\ t_3 := x \cdot \left(z \cdot -6\right)\\ \mathbf{if}\;z \leq -4.8 \cdot 10^{+125}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -3.8 \cdot 10^{+95}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;z \leq -3 \cdot 10^{+70}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -5.8:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;z \leq -6.2 \cdot 10^{-6}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 5 \cdot 10^{-69}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 4.8 \cdot 10^{+20}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 3.4 \cdot 10^{+126}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;z \leq 1.25 \cdot 10^{+189}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_3\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* y (* 6.0 z)))
        (t_1 (* 6.0 (* y z)))
        (t_2 (* -6.0 (* x z)))
        (t_3 (* x (* z -6.0))))
   (if (<= z -4.8e+125)
     t_1
     (if (<= z -3.8e+95)
       t_3
       (if (<= z -3e+70)
         t_1
         (if (<= z -5.8)
           t_2
           (if (<= z -6.2e-6)
             t_1
             (if (<= z 5e-69)
               x
               (if (<= z 4.8e+20)
                 t_0
                 (if (<= z 3.4e+126)
                   t_2
                   (if (<= z 1.25e+189) t_0 t_3)))))))))))
double code(double x, double y, double z) {
	double t_0 = y * (6.0 * z);
	double t_1 = 6.0 * (y * z);
	double t_2 = -6.0 * (x * z);
	double t_3 = x * (z * -6.0);
	double tmp;
	if (z <= -4.8e+125) {
		tmp = t_1;
	} else if (z <= -3.8e+95) {
		tmp = t_3;
	} else if (z <= -3e+70) {
		tmp = t_1;
	} else if (z <= -5.8) {
		tmp = t_2;
	} else if (z <= -6.2e-6) {
		tmp = t_1;
	} else if (z <= 5e-69) {
		tmp = x;
	} else if (z <= 4.8e+20) {
		tmp = t_0;
	} else if (z <= 3.4e+126) {
		tmp = t_2;
	} else if (z <= 1.25e+189) {
		tmp = t_0;
	} else {
		tmp = t_3;
	}
	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) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_0 = y * (6.0d0 * z)
    t_1 = 6.0d0 * (y * z)
    t_2 = (-6.0d0) * (x * z)
    t_3 = x * (z * (-6.0d0))
    if (z <= (-4.8d+125)) then
        tmp = t_1
    else if (z <= (-3.8d+95)) then
        tmp = t_3
    else if (z <= (-3d+70)) then
        tmp = t_1
    else if (z <= (-5.8d0)) then
        tmp = t_2
    else if (z <= (-6.2d-6)) then
        tmp = t_1
    else if (z <= 5d-69) then
        tmp = x
    else if (z <= 4.8d+20) then
        tmp = t_0
    else if (z <= 3.4d+126) then
        tmp = t_2
    else if (z <= 1.25d+189) then
        tmp = t_0
    else
        tmp = t_3
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = y * (6.0 * z);
	double t_1 = 6.0 * (y * z);
	double t_2 = -6.0 * (x * z);
	double t_3 = x * (z * -6.0);
	double tmp;
	if (z <= -4.8e+125) {
		tmp = t_1;
	} else if (z <= -3.8e+95) {
		tmp = t_3;
	} else if (z <= -3e+70) {
		tmp = t_1;
	} else if (z <= -5.8) {
		tmp = t_2;
	} else if (z <= -6.2e-6) {
		tmp = t_1;
	} else if (z <= 5e-69) {
		tmp = x;
	} else if (z <= 4.8e+20) {
		tmp = t_0;
	} else if (z <= 3.4e+126) {
		tmp = t_2;
	} else if (z <= 1.25e+189) {
		tmp = t_0;
	} else {
		tmp = t_3;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = y * (6.0 * z)
	t_1 = 6.0 * (y * z)
	t_2 = -6.0 * (x * z)
	t_3 = x * (z * -6.0)
	tmp = 0
	if z <= -4.8e+125:
		tmp = t_1
	elif z <= -3.8e+95:
		tmp = t_3
	elif z <= -3e+70:
		tmp = t_1
	elif z <= -5.8:
		tmp = t_2
	elif z <= -6.2e-6:
		tmp = t_1
	elif z <= 5e-69:
		tmp = x
	elif z <= 4.8e+20:
		tmp = t_0
	elif z <= 3.4e+126:
		tmp = t_2
	elif z <= 1.25e+189:
		tmp = t_0
	else:
		tmp = t_3
	return tmp
function code(x, y, z)
	t_0 = Float64(y * Float64(6.0 * z))
	t_1 = Float64(6.0 * Float64(y * z))
	t_2 = Float64(-6.0 * Float64(x * z))
	t_3 = Float64(x * Float64(z * -6.0))
	tmp = 0.0
	if (z <= -4.8e+125)
		tmp = t_1;
	elseif (z <= -3.8e+95)
		tmp = t_3;
	elseif (z <= -3e+70)
		tmp = t_1;
	elseif (z <= -5.8)
		tmp = t_2;
	elseif (z <= -6.2e-6)
		tmp = t_1;
	elseif (z <= 5e-69)
		tmp = x;
	elseif (z <= 4.8e+20)
		tmp = t_0;
	elseif (z <= 3.4e+126)
		tmp = t_2;
	elseif (z <= 1.25e+189)
		tmp = t_0;
	else
		tmp = t_3;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = y * (6.0 * z);
	t_1 = 6.0 * (y * z);
	t_2 = -6.0 * (x * z);
	t_3 = x * (z * -6.0);
	tmp = 0.0;
	if (z <= -4.8e+125)
		tmp = t_1;
	elseif (z <= -3.8e+95)
		tmp = t_3;
	elseif (z <= -3e+70)
		tmp = t_1;
	elseif (z <= -5.8)
		tmp = t_2;
	elseif (z <= -6.2e-6)
		tmp = t_1;
	elseif (z <= 5e-69)
		tmp = x;
	elseif (z <= 4.8e+20)
		tmp = t_0;
	elseif (z <= 3.4e+126)
		tmp = t_2;
	elseif (z <= 1.25e+189)
		tmp = t_0;
	else
		tmp = t_3;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.8e+125], t$95$1, If[LessEqual[z, -3.8e+95], t$95$3, If[LessEqual[z, -3e+70], t$95$1, If[LessEqual[z, -5.8], t$95$2, If[LessEqual[z, -6.2e-6], t$95$1, If[LessEqual[z, 5e-69], x, If[LessEqual[z, 4.8e+20], t$95$0, If[LessEqual[z, 3.4e+126], t$95$2, If[LessEqual[z, 1.25e+189], t$95$0, t$95$3]]]]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -3.8 \cdot 10^{+95}:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;z \leq -3 \cdot 10^{+70}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;z \leq -6.2 \cdot 10^{-6}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 5 \cdot 10^{-69}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 4.8 \cdot 10^{+20}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq 3.4 \cdot 10^{+126}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;z \leq 1.25 \cdot 10^{+189}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if z < -4.7999999999999999e125 or -3.7999999999999999e95 < z < -2.99999999999999976e70 or -5.79999999999999982 < z < -6.1999999999999999e-6

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

    if -4.7999999999999999e125 < z < -3.7999999999999999e95 or 1.2500000000000001e189 < z

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.99999999999999976e70 < z < -5.79999999999999982 or 4.8e20 < z < 3.39999999999999989e126

    1. Initial program 99.3%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r*99.6%

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left(y - x\right) \cdot z, 6, x\right)} \]
    4. Applied egg-rr99.4%

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

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

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

    if -6.1999999999999999e-6 < z < 5.00000000000000033e-69

    1. Initial program 99.8%

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

      \[\leadsto \color{blue}{x} \]

    if 5.00000000000000033e-69 < z < 4.8e20 or 3.39999999999999989e126 < z < 1.2500000000000001e189

    1. Initial program 99.6%

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left(y - x\right) \cdot z, 6, x\right)} \]
    4. Applied egg-rr99.5%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4.8 \cdot 10^{+125}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -3.8 \cdot 10^{+95}:\\ \;\;\;\;x \cdot \left(z \cdot -6\right)\\ \mathbf{elif}\;z \leq -3 \cdot 10^{+70}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -5.8:\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -6.2 \cdot 10^{-6}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 5 \cdot 10^{-69}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 4.8 \cdot 10^{+20}:\\ \;\;\;\;y \cdot \left(6 \cdot z\right)\\ \mathbf{elif}\;z \leq 3.4 \cdot 10^{+126}:\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq 1.25 \cdot 10^{+189}:\\ \;\;\;\;y \cdot \left(6 \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(z \cdot -6\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 84.4% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.55 \cdot 10^{-6} \lor \neg \left(z \leq 6.5 \cdot 10^{-69}\right):\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.5500000000000001e-6 or 6.49999999999999951e-69 < z

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

    if -2.5500000000000001e-6 < z < 6.49999999999999951e-69

    1. Initial program 99.8%

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

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

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

Alternative 6: 84.4% accurate, 0.5× speedup?

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

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

\mathbf{elif}\;z \leq 5.2 \cdot 10^{-69}:\\
\;\;\;\;x\\

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


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

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

    if -2.5500000000000001e-6 < z < 5.2000000000000004e-69

    1. Initial program 99.8%

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

      \[\leadsto \color{blue}{x} \]

    if 5.2000000000000004e-69 < z

    1. Initial program 99.6%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r*99.7%

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left(y - x\right) \cdot z, 6, x\right)} \]
    4. Applied egg-rr99.6%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.55 \cdot 10^{-6}:\\ \;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{elif}\;z \leq 5.2 \cdot 10^{-69}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;\left(y - x\right) \cdot \left(6 \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 83.9% accurate, 0.5× speedup?

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

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

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

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


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

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

    if -5.2e20 < z < 1.80000000000000009e-69

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

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

    if 1.80000000000000009e-69 < z

    1. Initial program 99.6%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r*99.7%

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left(y - x\right) \cdot z, 6, x\right)} \]
    4. Applied egg-rr99.6%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5.2 \cdot 10^{+20}:\\ \;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{-69}:\\ \;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;\left(y - x\right) \cdot \left(6 \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 98.7% accurate, 0.5× speedup?

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

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

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

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


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

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

    if -0.170000000000000012 < z < 5.4999999999999996e-9

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

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

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

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

    if 5.4999999999999996e-9 < z

    1. Initial program 99.7%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r*99.7%

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left(y - x\right) \cdot z, 6, x\right)} \]
    4. Applied egg-rr99.6%

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

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

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

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

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

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

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

Alternative 9: 61.0% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -0.17 \lor \neg \left(z \leq 5.5 \cdot 10^{-9}\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.17) (not (<= z 5.5e-9))) (* -6.0 (* x z)) x))
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -0.17) || !(z <= 5.5e-9)) {
		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.17d0)) .or. (.not. (z <= 5.5d-9))) 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.17) || !(z <= 5.5e-9)) {
		tmp = -6.0 * (x * z);
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (z <= -0.17) or not (z <= 5.5e-9):
		tmp = -6.0 * (x * z)
	else:
		tmp = x
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((z <= -0.17) || !(z <= 5.5e-9))
		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.17) || ~((z <= 5.5e-9)))
		tmp = -6.0 * (x * z);
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.17], N[Not[LessEqual[z, 5.5e-9]], $MachinePrecision]], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.17 \lor \neg \left(z \leq 5.5 \cdot 10^{-9}\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.170000000000000012 or 5.4999999999999996e-9 < z

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

    if -0.170000000000000012 < z < 5.4999999999999996e-9

    1. Initial program 99.8%

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

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

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

Alternative 10: 99.6% 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.7%

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

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

Alternative 11: 99.7% 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.7%

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

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

Alternative 12: 36.9% 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.7%

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

    \[\leadsto \color{blue}{x} \]
  4. Final simplification34.5%

    \[\leadsto x \]
  5. Add Preprocessing

Developer target: 99.7% 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 2024043 
(FPCore (x y z)
  :name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, E"
  :precision binary64

  :herbie-target
  (- x (* (* 6.0 z) (- x y)))

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