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

Percentage Accurate: 99.7% → 99.8%
Time: 10.2s
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.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, 0.1× speedup?

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

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

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

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

Alternative 2: 60.5% 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 -3.5 \cdot 10^{+129}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -8.5 \cdot 10^{+91}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -4.4 \cdot 10^{+69}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.25 \cdot 10^{+35}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.55 \cdot 10^{-24}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 0.166:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.45 \cdot 10^{+228} \lor \neg \left(z \leq 1.32 \cdot 10^{+306}\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.5e+129)
     t_0
     (if (<= z -8.5e+91)
       t_1
       (if (<= z -4.4e+69)
         t_0
         (if (<= z -1.25e+35)
           t_1
           (if (<= z -1.55e-24)
             t_0
             (if (<= z 0.166)
               x
               (if (or (<= z 1.45e+228) (not (<= z 1.32e+306)))
                 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.5e+129) {
		tmp = t_0;
	} else if (z <= -8.5e+91) {
		tmp = t_1;
	} else if (z <= -4.4e+69) {
		tmp = t_0;
	} else if (z <= -1.25e+35) {
		tmp = t_1;
	} else if (z <= -1.55e-24) {
		tmp = t_0;
	} else if (z <= 0.166) {
		tmp = x;
	} else if ((z <= 1.45e+228) || !(z <= 1.32e+306)) {
		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.5d+129)) then
        tmp = t_0
    else if (z <= (-8.5d+91)) then
        tmp = t_1
    else if (z <= (-4.4d+69)) then
        tmp = t_0
    else if (z <= (-1.25d+35)) then
        tmp = t_1
    else if (z <= (-1.55d-24)) then
        tmp = t_0
    else if (z <= 0.166d0) then
        tmp = x
    else if ((z <= 1.45d+228) .or. (.not. (z <= 1.32d+306))) 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.5e+129) {
		tmp = t_0;
	} else if (z <= -8.5e+91) {
		tmp = t_1;
	} else if (z <= -4.4e+69) {
		tmp = t_0;
	} else if (z <= -1.25e+35) {
		tmp = t_1;
	} else if (z <= -1.55e-24) {
		tmp = t_0;
	} else if (z <= 0.166) {
		tmp = x;
	} else if ((z <= 1.45e+228) || !(z <= 1.32e+306)) {
		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.5e+129:
		tmp = t_0
	elif z <= -8.5e+91:
		tmp = t_1
	elif z <= -4.4e+69:
		tmp = t_0
	elif z <= -1.25e+35:
		tmp = t_1
	elif z <= -1.55e-24:
		tmp = t_0
	elif z <= 0.166:
		tmp = x
	elif (z <= 1.45e+228) or not (z <= 1.32e+306):
		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.5e+129)
		tmp = t_0;
	elseif (z <= -8.5e+91)
		tmp = t_1;
	elseif (z <= -4.4e+69)
		tmp = t_0;
	elseif (z <= -1.25e+35)
		tmp = t_1;
	elseif (z <= -1.55e-24)
		tmp = t_0;
	elseif (z <= 0.166)
		tmp = x;
	elseif ((z <= 1.45e+228) || !(z <= 1.32e+306))
		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.5e+129)
		tmp = t_0;
	elseif (z <= -8.5e+91)
		tmp = t_1;
	elseif (z <= -4.4e+69)
		tmp = t_0;
	elseif (z <= -1.25e+35)
		tmp = t_1;
	elseif (z <= -1.55e-24)
		tmp = t_0;
	elseif (z <= 0.166)
		tmp = x;
	elseif ((z <= 1.45e+228) || ~((z <= 1.32e+306)))
		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.5e+129], t$95$0, If[LessEqual[z, -8.5e+91], t$95$1, If[LessEqual[z, -4.4e+69], t$95$0, If[LessEqual[z, -1.25e+35], t$95$1, If[LessEqual[z, -1.55e-24], t$95$0, If[LessEqual[z, 0.166], x, If[Or[LessEqual[z, 1.45e+228], N[Not[LessEqual[z, 1.32e+306]], $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.5 \cdot 10^{+129}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq -8.5 \cdot 10^{+91}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq -4.4 \cdot 10^{+69}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq -1.25 \cdot 10^{+35}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq -1.55 \cdot 10^{-24}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;z \leq 1.45 \cdot 10^{+228} \lor \neg \left(z \leq 1.32 \cdot 10^{+306}\right):\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -3.4999999999999998e129 or -8.4999999999999995e91 < z < -4.4000000000000003e69 or -1.25000000000000005e35 < z < -1.55e-24 or 1.45000000000000001e228 < z < 1.32e306

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

        \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot z\right) \cdot 6} + x \]
      5. fma-def99.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 70.8%

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

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

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

    if -3.4999999999999998e129 < z < -8.4999999999999995e91 or -4.4000000000000003e69 < z < -1.25000000000000005e35 or 0.166000000000000009 < z < 1.45000000000000001e228 or 1.32e306 < 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.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.7%

        \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot z\right) \cdot 6} + x \]
      5. fma-def99.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.7%

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

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

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

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

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

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

    if -1.55e-24 < z < 0.166000000000000009

    1. Initial program 99.1%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.5 \cdot 10^{+129}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -8.5 \cdot 10^{+91}:\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -4.4 \cdot 10^{+69}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -1.25 \cdot 10^{+35}:\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -1.55 \cdot 10^{-24}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 0.166:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.45 \cdot 10^{+228} \lor \neg \left(z \leq 1.32 \cdot 10^{+306}\right):\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 60.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)\\ t_2 := -6 \cdot \left(x \cdot z\right)\\ \mathbf{if}\;z \leq -1.55 \cdot 10^{+126}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.26 \cdot 10^{+85}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -9.4 \cdot 10^{+67}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.5 \cdot 10^{+37}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.36 \cdot 10^{-24}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 0.166:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 2.25 \cdot 10^{+226}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 4.8 \cdot 10^{+284}:\\ \;\;\;\;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 (* x (* z -6.0))) (t_2 (* -6.0 (* x z))))
   (if (<= z -1.55e+126)
     t_0
     (if (<= z -1.26e+85)
       t_2
       (if (<= z -9.4e+67)
         t_0
         (if (<= z -1.5e+37)
           t_1
           (if (<= z -1.36e-24)
             t_0
             (if (<= z 0.166)
               x
               (if (<= z 2.25e+226) t_1 (if (<= z 4.8e+284) t_0 t_2))))))))))
double code(double x, double y, double z) {
	double t_0 = 6.0 * (y * z);
	double t_1 = x * (z * -6.0);
	double t_2 = -6.0 * (x * z);
	double tmp;
	if (z <= -1.55e+126) {
		tmp = t_0;
	} else if (z <= -1.26e+85) {
		tmp = t_2;
	} else if (z <= -9.4e+67) {
		tmp = t_0;
	} else if (z <= -1.5e+37) {
		tmp = t_1;
	} else if (z <= -1.36e-24) {
		tmp = t_0;
	} else if (z <= 0.166) {
		tmp = x;
	} else if (z <= 2.25e+226) {
		tmp = t_1;
	} else if (z <= 4.8e+284) {
		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 = x * (z * (-6.0d0))
    t_2 = (-6.0d0) * (x * z)
    if (z <= (-1.55d+126)) then
        tmp = t_0
    else if (z <= (-1.26d+85)) then
        tmp = t_2
    else if (z <= (-9.4d+67)) then
        tmp = t_0
    else if (z <= (-1.5d+37)) then
        tmp = t_1
    else if (z <= (-1.36d-24)) then
        tmp = t_0
    else if (z <= 0.166d0) then
        tmp = x
    else if (z <= 2.25d+226) then
        tmp = t_1
    else if (z <= 4.8d+284) 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 = x * (z * -6.0);
	double t_2 = -6.0 * (x * z);
	double tmp;
	if (z <= -1.55e+126) {
		tmp = t_0;
	} else if (z <= -1.26e+85) {
		tmp = t_2;
	} else if (z <= -9.4e+67) {
		tmp = t_0;
	} else if (z <= -1.5e+37) {
		tmp = t_1;
	} else if (z <= -1.36e-24) {
		tmp = t_0;
	} else if (z <= 0.166) {
		tmp = x;
	} else if (z <= 2.25e+226) {
		tmp = t_1;
	} else if (z <= 4.8e+284) {
		tmp = t_0;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 6.0 * (y * z)
	t_1 = x * (z * -6.0)
	t_2 = -6.0 * (x * z)
	tmp = 0
	if z <= -1.55e+126:
		tmp = t_0
	elif z <= -1.26e+85:
		tmp = t_2
	elif z <= -9.4e+67:
		tmp = t_0
	elif z <= -1.5e+37:
		tmp = t_1
	elif z <= -1.36e-24:
		tmp = t_0
	elif z <= 0.166:
		tmp = x
	elif z <= 2.25e+226:
		tmp = t_1
	elif z <= 4.8e+284:
		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(x * Float64(z * -6.0))
	t_2 = Float64(-6.0 * Float64(x * z))
	tmp = 0.0
	if (z <= -1.55e+126)
		tmp = t_0;
	elseif (z <= -1.26e+85)
		tmp = t_2;
	elseif (z <= -9.4e+67)
		tmp = t_0;
	elseif (z <= -1.5e+37)
		tmp = t_1;
	elseif (z <= -1.36e-24)
		tmp = t_0;
	elseif (z <= 0.166)
		tmp = x;
	elseif (z <= 2.25e+226)
		tmp = t_1;
	elseif (z <= 4.8e+284)
		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 = x * (z * -6.0);
	t_2 = -6.0 * (x * z);
	tmp = 0.0;
	if (z <= -1.55e+126)
		tmp = t_0;
	elseif (z <= -1.26e+85)
		tmp = t_2;
	elseif (z <= -9.4e+67)
		tmp = t_0;
	elseif (z <= -1.5e+37)
		tmp = t_1;
	elseif (z <= -1.36e-24)
		tmp = t_0;
	elseif (z <= 0.166)
		tmp = x;
	elseif (z <= 2.25e+226)
		tmp = t_1;
	elseif (z <= 4.8e+284)
		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[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.55e+126], t$95$0, If[LessEqual[z, -1.26e+85], t$95$2, If[LessEqual[z, -9.4e+67], t$95$0, If[LessEqual[z, -1.5e+37], t$95$1, If[LessEqual[z, -1.36e-24], t$95$0, If[LessEqual[z, 0.166], x, If[LessEqual[z, 2.25e+226], t$95$1, If[LessEqual[z, 4.8e+284], t$95$0, t$95$2]]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -1.26 \cdot 10^{+85}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \leq -9.4 \cdot 10^{+67}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq -1.5 \cdot 10^{+37}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq -1.36 \cdot 10^{-24}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;z \leq 2.25 \cdot 10^{+226}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 4.8 \cdot 10^{+284}:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -1.55e126 or -1.26000000000000003e85 < z < -9.40000000000000035e67 or -1.50000000000000011e37 < z < -1.36000000000000001e-24 or 2.24999999999999995e226 < z < 4.8000000000000001e284

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

        \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot z\right) \cdot 6} + x \]
      5. fma-def99.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 70.8%

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

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

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

    if -1.55e126 < z < -1.26000000000000003e85 or 4.8000000000000001e284 < z

    1. Initial program 100.0%

      \[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*100.0%

        \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot z\right) \cdot 6} + x \]
      5. fma-def99.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 100.0%

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

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

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

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

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

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

    if -9.40000000000000035e67 < z < -1.50000000000000011e37 or 0.166000000000000009 < z < 2.24999999999999995e226

    1. Initial program 99.5%

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

        \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot z\right) \cdot 6} + x \]
      5. fma-def99.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.7%

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

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

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

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

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

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

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

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

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

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

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

    if -1.36000000000000001e-24 < z < 0.166000000000000009

    1. Initial program 99.1%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.55 \cdot 10^{+126}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -1.26 \cdot 10^{+85}:\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -9.4 \cdot 10^{+67}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -1.5 \cdot 10^{+37}:\\ \;\;\;\;x \cdot \left(z \cdot -6\right)\\ \mathbf{elif}\;z \leq -1.36 \cdot 10^{-24}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 0.166:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 2.25 \cdot 10^{+226}:\\ \;\;\;\;x \cdot \left(z \cdot -6\right)\\ \mathbf{elif}\;z \leq 4.8 \cdot 10^{+284}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 60.3% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \left(y \cdot 6\right)\\ t_1 := 6 \cdot \left(y \cdot z\right)\\ t_2 := x \cdot \left(z \cdot -6\right)\\ t_3 := -6 \cdot \left(x \cdot z\right)\\ \mathbf{if}\;z \leq -2.6 \cdot 10^{+133}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -4.1 \cdot 10^{+86}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq -9.5 \cdot 10^{+64}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -3.2 \cdot 10^{+35}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -1.1 \cdot 10^{-24}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 0.166:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 2.8 \cdot 10^{+231}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 1.5 \cdot 10^{+302}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* z (* y 6.0)))
        (t_1 (* 6.0 (* y z)))
        (t_2 (* x (* z -6.0)))
        (t_3 (* -6.0 (* x z))))
   (if (<= z -2.6e+133)
     t_1
     (if (<= z -4.1e+86)
       t_3
       (if (<= z -9.5e+64)
         t_0
         (if (<= z -3.2e+35)
           t_2
           (if (<= z -1.1e-24)
             t_0
             (if (<= z 0.166)
               x
               (if (<= z 2.8e+231) t_2 (if (<= z 1.5e+302) t_1 t_3))))))))))
double code(double x, double y, double z) {
	double t_0 = z * (y * 6.0);
	double t_1 = 6.0 * (y * z);
	double t_2 = x * (z * -6.0);
	double t_3 = -6.0 * (x * z);
	double tmp;
	if (z <= -2.6e+133) {
		tmp = t_1;
	} else if (z <= -4.1e+86) {
		tmp = t_3;
	} else if (z <= -9.5e+64) {
		tmp = t_0;
	} else if (z <= -3.2e+35) {
		tmp = t_2;
	} else if (z <= -1.1e-24) {
		tmp = t_0;
	} else if (z <= 0.166) {
		tmp = x;
	} else if (z <= 2.8e+231) {
		tmp = t_2;
	} else if (z <= 1.5e+302) {
		tmp = t_1;
	} 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 = z * (y * 6.0d0)
    t_1 = 6.0d0 * (y * z)
    t_2 = x * (z * (-6.0d0))
    t_3 = (-6.0d0) * (x * z)
    if (z <= (-2.6d+133)) then
        tmp = t_1
    else if (z <= (-4.1d+86)) then
        tmp = t_3
    else if (z <= (-9.5d+64)) then
        tmp = t_0
    else if (z <= (-3.2d+35)) then
        tmp = t_2
    else if (z <= (-1.1d-24)) then
        tmp = t_0
    else if (z <= 0.166d0) then
        tmp = x
    else if (z <= 2.8d+231) then
        tmp = t_2
    else if (z <= 1.5d+302) then
        tmp = t_1
    else
        tmp = t_3
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = z * (y * 6.0);
	double t_1 = 6.0 * (y * z);
	double t_2 = x * (z * -6.0);
	double t_3 = -6.0 * (x * z);
	double tmp;
	if (z <= -2.6e+133) {
		tmp = t_1;
	} else if (z <= -4.1e+86) {
		tmp = t_3;
	} else if (z <= -9.5e+64) {
		tmp = t_0;
	} else if (z <= -3.2e+35) {
		tmp = t_2;
	} else if (z <= -1.1e-24) {
		tmp = t_0;
	} else if (z <= 0.166) {
		tmp = x;
	} else if (z <= 2.8e+231) {
		tmp = t_2;
	} else if (z <= 1.5e+302) {
		tmp = t_1;
	} else {
		tmp = t_3;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = z * (y * 6.0)
	t_1 = 6.0 * (y * z)
	t_2 = x * (z * -6.0)
	t_3 = -6.0 * (x * z)
	tmp = 0
	if z <= -2.6e+133:
		tmp = t_1
	elif z <= -4.1e+86:
		tmp = t_3
	elif z <= -9.5e+64:
		tmp = t_0
	elif z <= -3.2e+35:
		tmp = t_2
	elif z <= -1.1e-24:
		tmp = t_0
	elif z <= 0.166:
		tmp = x
	elif z <= 2.8e+231:
		tmp = t_2
	elif z <= 1.5e+302:
		tmp = t_1
	else:
		tmp = t_3
	return tmp
function code(x, y, z)
	t_0 = Float64(z * Float64(y * 6.0))
	t_1 = Float64(6.0 * Float64(y * z))
	t_2 = Float64(x * Float64(z * -6.0))
	t_3 = Float64(-6.0 * Float64(x * z))
	tmp = 0.0
	if (z <= -2.6e+133)
		tmp = t_1;
	elseif (z <= -4.1e+86)
		tmp = t_3;
	elseif (z <= -9.5e+64)
		tmp = t_0;
	elseif (z <= -3.2e+35)
		tmp = t_2;
	elseif (z <= -1.1e-24)
		tmp = t_0;
	elseif (z <= 0.166)
		tmp = x;
	elseif (z <= 2.8e+231)
		tmp = t_2;
	elseif (z <= 1.5e+302)
		tmp = t_1;
	else
		tmp = t_3;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = z * (y * 6.0);
	t_1 = 6.0 * (y * z);
	t_2 = x * (z * -6.0);
	t_3 = -6.0 * (x * z);
	tmp = 0.0;
	if (z <= -2.6e+133)
		tmp = t_1;
	elseif (z <= -4.1e+86)
		tmp = t_3;
	elseif (z <= -9.5e+64)
		tmp = t_0;
	elseif (z <= -3.2e+35)
		tmp = t_2;
	elseif (z <= -1.1e-24)
		tmp = t_0;
	elseif (z <= 0.166)
		tmp = x;
	elseif (z <= 2.8e+231)
		tmp = t_2;
	elseif (z <= 1.5e+302)
		tmp = t_1;
	else
		tmp = t_3;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.6e+133], t$95$1, If[LessEqual[z, -4.1e+86], t$95$3, If[LessEqual[z, -9.5e+64], t$95$0, If[LessEqual[z, -3.2e+35], t$95$2, If[LessEqual[z, -1.1e-24], t$95$0, If[LessEqual[z, 0.166], x, If[LessEqual[z, 2.8e+231], t$95$2, If[LessEqual[z, 1.5e+302], t$95$1, t$95$3]]]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -4.1 \cdot 10^{+86}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;z \leq -9.5 \cdot 10^{+64}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq -3.2 \cdot 10^{+35}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \leq -1.1 \cdot 10^{-24}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;z \leq 2.8 \cdot 10^{+231}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \leq 1.5 \cdot 10^{+302}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_3\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if z < -2.5999999999999998e133 or 2.8e231 < z < 1.4999999999999999e302

    1. Initial program 99.9%

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

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

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

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

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

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

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

    if -2.5999999999999998e133 < z < -4.0999999999999999e86 or 1.4999999999999999e302 < z

    1. Initial program 100.0%

      \[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*100.0%

        \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot z\right) \cdot 6} + x \]
      5. fma-def99.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 100.0%

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

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

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

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

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

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

    if -4.0999999999999999e86 < z < -9.50000000000000028e64 or -3.19999999999999983e35 < z < -1.10000000000000001e-24

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

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

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

        \[\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-def99.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 y around inf 78.8%

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

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

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

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

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

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

    if -9.50000000000000028e64 < z < -3.19999999999999983e35 or 0.166000000000000009 < z < 2.8e231

    1. Initial program 99.5%

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

        \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot z\right) \cdot 6} + x \]
      5. fma-def99.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.7%

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

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

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

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

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

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

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

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

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

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

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

    if -1.10000000000000001e-24 < z < 0.166000000000000009

    1. Initial program 99.1%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.6 \cdot 10^{+133}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -4.1 \cdot 10^{+86}:\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -9.5 \cdot 10^{+64}:\\ \;\;\;\;z \cdot \left(y \cdot 6\right)\\ \mathbf{elif}\;z \leq -3.2 \cdot 10^{+35}:\\ \;\;\;\;x \cdot \left(z \cdot -6\right)\\ \mathbf{elif}\;z \leq -1.1 \cdot 10^{-24}:\\ \;\;\;\;z \cdot \left(y \cdot 6\right)\\ \mathbf{elif}\;z \leq 0.166:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 2.8 \cdot 10^{+231}:\\ \;\;\;\;x \cdot \left(z \cdot -6\right)\\ \mathbf{elif}\;z \leq 1.5 \cdot 10^{+302}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 84.4% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.6 \cdot 10^{-25} \lor \neg \left(z \leq 1.3 \cdot 10^{-42}\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 < -1.6000000000000001e-25 or 1.3e-42 < 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.8%

        \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot z\right) \cdot 6} + x \]
      5. fma-def99.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 94.9%

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

    if -1.6000000000000001e-25 < z < 1.3e-42

    1. Initial program 99.1%

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

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

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

Alternative 6: 98.7% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -0.165000000000000008 or 0.166000000000000009 < 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.8%

        \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot z\right) \cdot 6} + x \]
      5. fma-def99.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.2%

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

    if -0.165000000000000008 < z < 0.166000000000000009

    1. Initial program 99.2%

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

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

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

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

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

Alternative 7: 98.6% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -0.149999999999999994 or 0.166000000000000009 < 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.8%

        \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot z\right) \cdot 6} + x \]
      5. fma-def99.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.2%

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

    if -0.149999999999999994 < z < 0.166000000000000009

    1. Initial program 99.2%

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

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

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

Alternative 8: 84.6% accurate, 0.5× speedup?

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

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

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

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


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

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

        \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot z\right) \cdot 6} + x \]
      5. fma-def99.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 95.4%

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

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

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

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

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

    if -1.11999999999999995e-24 < z < 3.7e-32

    1. Initial program 99.1%

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

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

    if 3.7e-32 < 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.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.8%

        \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot z\right) \cdot 6} + x \]
      5. fma-def99.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 94.5%

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

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

Alternative 9: 84.5% accurate, 0.5× speedup?

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

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

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

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


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

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

        \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot z\right) \cdot 6} + x \]
      5. fma-def99.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 95.4%

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

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

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

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

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

    if -1.49999999999999998e-24 < z < 1.75e15

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

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

    if 1.75e15 < 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.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.8%

        \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot z\right) \cdot 6} + x \]
      5. fma-def99.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.8%

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

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

Alternative 10: 61.0% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -0.165 \lor \neg \left(z \leq 0.166\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.166))) (* -6.0 (* x z)) x))
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -0.165) || !(z <= 0.166)) {
		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.166d0))) 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.166)) {
		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.166):
		tmp = -6.0 * (x * z)
	else:
		tmp = x
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((z <= -0.165) || !(z <= 0.166))
		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.166)))
		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.166]], $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.166\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.166000000000000009 < 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.8%

        \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot z\right) \cdot 6} + x \]
      5. fma-def99.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.2%

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

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

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

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

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

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

    if -0.165000000000000008 < z < 0.166000000000000009

    1. Initial program 99.2%

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

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

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

Alternative 11: 99.8% accurate, 1.0× speedup?

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

\\
x + 6 \cdot \left(\left(y - x\right) \cdot z\right)
\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 99.8%

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

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

Alternative 12: 36.7% 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 39.0%

    \[\leadsto \color{blue}{x} \]
  4. Final simplification39.0%

    \[\leadsto x \]
  5. 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 2024024 
(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)))