Graphics.Rasterific.Svg.PathConverter:segmentToBezier from rasterific-svg-0.2.3.1, C

Percentage Accurate: 99.9% → 99.9%
Time: 8.1s
Alternatives: 11
Speedup: 1.0×

Specification

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

\\
\left(x + \sin y\right) + z \cdot \cos y
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 11 alternatives:

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

Initial Program: 99.9% accurate, 1.0× speedup?

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

\\
\left(x + \sin y\right) + z \cdot \cos y
\end{array}

Alternative 1: 99.9% accurate, 1.0× speedup?

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

\\
z \cdot \cos y + \left(x + \sin y\right)
\end{array}
Derivation
  1. Initial program 99.9%

    \[\left(x + \sin y\right) + z \cdot \cos y \]
  2. Final simplification99.9%

    \[\leadsto z \cdot \cos y + \left(x + \sin y\right) \]

Alternative 2: 68.5% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \cos y\\ \mathbf{if}\;z \leq -4.8 \cdot 10^{+113}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -3.15 \cdot 10^{-18}:\\ \;\;\;\;x + z\\ \mathbf{elif}\;z \leq -1.75 \cdot 10^{-154}:\\ \;\;\;\;\sin y\\ \mathbf{elif}\;z \leq 5.5 \cdot 10^{-214}:\\ \;\;\;\;y + \left(x + z\right)\\ \mathbf{elif}\;z \leq 8.8 \cdot 10^{+180}:\\ \;\;\;\;x + z\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* z (cos y))))
   (if (<= z -4.8e+113)
     t_0
     (if (<= z -3.15e-18)
       (+ x z)
       (if (<= z -1.75e-154)
         (sin y)
         (if (<= z 5.5e-214)
           (+ y (+ x z))
           (if (<= z 8.8e+180) (+ x z) t_0)))))))
double code(double x, double y, double z) {
	double t_0 = z * cos(y);
	double tmp;
	if (z <= -4.8e+113) {
		tmp = t_0;
	} else if (z <= -3.15e-18) {
		tmp = x + z;
	} else if (z <= -1.75e-154) {
		tmp = sin(y);
	} else if (z <= 5.5e-214) {
		tmp = y + (x + z);
	} else if (z <= 8.8e+180) {
		tmp = x + z;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = z * cos(y)
    if (z <= (-4.8d+113)) then
        tmp = t_0
    else if (z <= (-3.15d-18)) then
        tmp = x + z
    else if (z <= (-1.75d-154)) then
        tmp = sin(y)
    else if (z <= 5.5d-214) then
        tmp = y + (x + z)
    else if (z <= 8.8d+180) then
        tmp = x + z
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = z * Math.cos(y);
	double tmp;
	if (z <= -4.8e+113) {
		tmp = t_0;
	} else if (z <= -3.15e-18) {
		tmp = x + z;
	} else if (z <= -1.75e-154) {
		tmp = Math.sin(y);
	} else if (z <= 5.5e-214) {
		tmp = y + (x + z);
	} else if (z <= 8.8e+180) {
		tmp = x + z;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = z * math.cos(y)
	tmp = 0
	if z <= -4.8e+113:
		tmp = t_0
	elif z <= -3.15e-18:
		tmp = x + z
	elif z <= -1.75e-154:
		tmp = math.sin(y)
	elif z <= 5.5e-214:
		tmp = y + (x + z)
	elif z <= 8.8e+180:
		tmp = x + z
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(z * cos(y))
	tmp = 0.0
	if (z <= -4.8e+113)
		tmp = t_0;
	elseif (z <= -3.15e-18)
		tmp = Float64(x + z);
	elseif (z <= -1.75e-154)
		tmp = sin(y);
	elseif (z <= 5.5e-214)
		tmp = Float64(y + Float64(x + z));
	elseif (z <= 8.8e+180)
		tmp = Float64(x + z);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = z * cos(y);
	tmp = 0.0;
	if (z <= -4.8e+113)
		tmp = t_0;
	elseif (z <= -3.15e-18)
		tmp = x + z;
	elseif (z <= -1.75e-154)
		tmp = sin(y);
	elseif (z <= 5.5e-214)
		tmp = y + (x + z);
	elseif (z <= 8.8e+180)
		tmp = x + z;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.8e+113], t$95$0, If[LessEqual[z, -3.15e-18], N[(x + z), $MachinePrecision], If[LessEqual[z, -1.75e-154], N[Sin[y], $MachinePrecision], If[LessEqual[z, 5.5e-214], N[(y + N[(x + z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8.8e+180], N[(x + z), $MachinePrecision], t$95$0]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -4.8 \cdot 10^{+113}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq -3.15 \cdot 10^{-18}:\\
\;\;\;\;x + z\\

\mathbf{elif}\;z \leq -1.75 \cdot 10^{-154}:\\
\;\;\;\;\sin y\\

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

\mathbf{elif}\;z \leq 8.8 \cdot 10^{+180}:\\
\;\;\;\;x + z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -4.79999999999999966e113 or 8.7999999999999997e180 < z

    1. Initial program 99.8%

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

        \[\leadsto \color{blue}{z \cdot \cos y + \left(x + \sin y\right)} \]
      2. add-cube-cbrt99.1%

        \[\leadsto z \cdot \color{blue}{\left(\left(\sqrt[3]{\cos y} \cdot \sqrt[3]{\cos y}\right) \cdot \sqrt[3]{\cos y}\right)} + \left(x + \sin y\right) \]
      3. associate-*r*99.1%

        \[\leadsto \color{blue}{\left(z \cdot \left(\sqrt[3]{\cos y} \cdot \sqrt[3]{\cos y}\right)\right) \cdot \sqrt[3]{\cos y}} + \left(x + \sin y\right) \]
      4. fma-def99.1%

        \[\leadsto \color{blue}{\mathsf{fma}\left(z \cdot \left(\sqrt[3]{\cos y} \cdot \sqrt[3]{\cos y}\right), \sqrt[3]{\cos y}, x + \sin y\right)} \]
      5. pow299.1%

        \[\leadsto \mathsf{fma}\left(z \cdot \color{blue}{{\left(\sqrt[3]{\cos y}\right)}^{2}}, \sqrt[3]{\cos y}, x + \sin y\right) \]
    3. Applied egg-rr99.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(z \cdot {\left(\sqrt[3]{\cos y}\right)}^{2}, \sqrt[3]{\cos y}, x + \sin y\right)} \]
    4. Taylor expanded in z around inf 92.1%

      \[\leadsto \color{blue}{{1}^{0.3333333333333333} \cdot \left(z \cdot \cos y\right)} \]
    5. Step-by-step derivation
      1. pow-base-192.1%

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

        \[\leadsto 1 \cdot \color{blue}{\left(\cos y \cdot z\right)} \]
      3. *-lft-identity92.1%

        \[\leadsto \color{blue}{\cos y \cdot z} \]
    6. Simplified92.1%

      \[\leadsto \color{blue}{\cos y \cdot z} \]

    if -4.79999999999999966e113 < z < -3.1500000000000002e-18 or 5.50000000000000024e-214 < z < 8.7999999999999997e180

    1. Initial program 100.0%

      \[\left(x + \sin y\right) + z \cdot \cos y \]
    2. Taylor expanded in y around 0 79.1%

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

    if -3.1500000000000002e-18 < z < -1.75e-154

    1. Initial program 99.9%

      \[\left(x + \sin y\right) + z \cdot \cos y \]
    2. Taylor expanded in x around 0 71.6%

      \[\leadsto \color{blue}{z \cdot \cos y + \sin y} \]
    3. Taylor expanded in z around 0 60.9%

      \[\leadsto \color{blue}{\sin y} \]

    if -1.75e-154 < z < 5.50000000000000024e-214

    1. Initial program 100.0%

      \[\left(x + \sin y\right) + z \cdot \cos y \]
    2. Taylor expanded in y around 0 65.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4.8 \cdot 10^{+113}:\\ \;\;\;\;z \cdot \cos y\\ \mathbf{elif}\;z \leq -3.15 \cdot 10^{-18}:\\ \;\;\;\;x + z\\ \mathbf{elif}\;z \leq -1.75 \cdot 10^{-154}:\\ \;\;\;\;\sin y\\ \mathbf{elif}\;z \leq 5.5 \cdot 10^{-214}:\\ \;\;\;\;y + \left(x + z\right)\\ \mathbf{elif}\;z \leq 8.8 \cdot 10^{+180}:\\ \;\;\;\;x + z\\ \mathbf{else}:\\ \;\;\;\;z \cdot \cos y\\ \end{array} \]

Alternative 3: 77.1% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin y + z\\ \mathbf{if}\;x \leq -2500:\\ \;\;\;\;x + z\\ \mathbf{elif}\;x \leq 3.1 \cdot 10^{-262}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 3.3 \cdot 10^{-227}:\\ \;\;\;\;z \cdot \cos y\\ \mathbf{elif}\;x \leq 3.5 \cdot 10^{-9}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;x + z\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (+ (sin y) z)))
   (if (<= x -2500.0)
     (+ x z)
     (if (<= x 3.1e-262)
       t_0
       (if (<= x 3.3e-227) (* z (cos y)) (if (<= x 3.5e-9) t_0 (+ x z)))))))
double code(double x, double y, double z) {
	double t_0 = sin(y) + z;
	double tmp;
	if (x <= -2500.0) {
		tmp = x + z;
	} else if (x <= 3.1e-262) {
		tmp = t_0;
	} else if (x <= 3.3e-227) {
		tmp = z * cos(y);
	} else if (x <= 3.5e-9) {
		tmp = t_0;
	} else {
		tmp = x + z;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = sin(y) + z
    if (x <= (-2500.0d0)) then
        tmp = x + z
    else if (x <= 3.1d-262) then
        tmp = t_0
    else if (x <= 3.3d-227) then
        tmp = z * cos(y)
    else if (x <= 3.5d-9) then
        tmp = t_0
    else
        tmp = x + z
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = Math.sin(y) + z;
	double tmp;
	if (x <= -2500.0) {
		tmp = x + z;
	} else if (x <= 3.1e-262) {
		tmp = t_0;
	} else if (x <= 3.3e-227) {
		tmp = z * Math.cos(y);
	} else if (x <= 3.5e-9) {
		tmp = t_0;
	} else {
		tmp = x + z;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = math.sin(y) + z
	tmp = 0
	if x <= -2500.0:
		tmp = x + z
	elif x <= 3.1e-262:
		tmp = t_0
	elif x <= 3.3e-227:
		tmp = z * math.cos(y)
	elif x <= 3.5e-9:
		tmp = t_0
	else:
		tmp = x + z
	return tmp
function code(x, y, z)
	t_0 = Float64(sin(y) + z)
	tmp = 0.0
	if (x <= -2500.0)
		tmp = Float64(x + z);
	elseif (x <= 3.1e-262)
		tmp = t_0;
	elseif (x <= 3.3e-227)
		tmp = Float64(z * cos(y));
	elseif (x <= 3.5e-9)
		tmp = t_0;
	else
		tmp = Float64(x + z);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = sin(y) + z;
	tmp = 0.0;
	if (x <= -2500.0)
		tmp = x + z;
	elseif (x <= 3.1e-262)
		tmp = t_0;
	elseif (x <= 3.3e-227)
		tmp = z * cos(y);
	elseif (x <= 3.5e-9)
		tmp = t_0;
	else
		tmp = x + z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Sin[y], $MachinePrecision] + z), $MachinePrecision]}, If[LessEqual[x, -2500.0], N[(x + z), $MachinePrecision], If[LessEqual[x, 3.1e-262], t$95$0, If[LessEqual[x, 3.3e-227], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.5e-9], t$95$0, N[(x + z), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin y + z\\
\mathbf{if}\;x \leq -2500:\\
\;\;\;\;x + z\\

\mathbf{elif}\;x \leq 3.1 \cdot 10^{-262}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;x \leq 3.3 \cdot 10^{-227}:\\
\;\;\;\;z \cdot \cos y\\

\mathbf{elif}\;x \leq 3.5 \cdot 10^{-9}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2500 or 3.4999999999999999e-9 < x

    1. Initial program 100.0%

      \[\left(x + \sin y\right) + z \cdot \cos y \]
    2. Taylor expanded in y around 0 85.8%

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

    if -2500 < x < 3.0999999999999998e-262 or 3.2999999999999999e-227 < x < 3.4999999999999999e-9

    1. Initial program 99.9%

      \[\left(x + \sin y\right) + z \cdot \cos y \]
    2. Taylor expanded in x around 0 93.4%

      \[\leadsto \color{blue}{z \cdot \cos y + \sin y} \]
    3. Taylor expanded in y around 0 78.7%

      \[\leadsto \color{blue}{z} + \sin y \]

    if 3.0999999999999998e-262 < x < 3.2999999999999999e-227

    1. Initial program 100.0%

      \[\left(x + \sin y\right) + z \cdot \cos y \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \color{blue}{z \cdot \cos y + \left(x + \sin y\right)} \]
      2. add-cube-cbrt98.9%

        \[\leadsto z \cdot \color{blue}{\left(\left(\sqrt[3]{\cos y} \cdot \sqrt[3]{\cos y}\right) \cdot \sqrt[3]{\cos y}\right)} + \left(x + \sin y\right) \]
      3. associate-*r*98.7%

        \[\leadsto \color{blue}{\left(z \cdot \left(\sqrt[3]{\cos y} \cdot \sqrt[3]{\cos y}\right)\right) \cdot \sqrt[3]{\cos y}} + \left(x + \sin y\right) \]
      4. fma-def98.7%

        \[\leadsto \color{blue}{\mathsf{fma}\left(z \cdot \left(\sqrt[3]{\cos y} \cdot \sqrt[3]{\cos y}\right), \sqrt[3]{\cos y}, x + \sin y\right)} \]
      5. pow298.7%

        \[\leadsto \mathsf{fma}\left(z \cdot \color{blue}{{\left(\sqrt[3]{\cos y}\right)}^{2}}, \sqrt[3]{\cos y}, x + \sin y\right) \]
    3. Applied egg-rr98.7%

      \[\leadsto \color{blue}{\mathsf{fma}\left(z \cdot {\left(\sqrt[3]{\cos y}\right)}^{2}, \sqrt[3]{\cos y}, x + \sin y\right)} \]
    4. Taylor expanded in z around inf 91.5%

      \[\leadsto \color{blue}{{1}^{0.3333333333333333} \cdot \left(z \cdot \cos y\right)} \]
    5. Step-by-step derivation
      1. pow-base-191.5%

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

        \[\leadsto 1 \cdot \color{blue}{\left(\cos y \cdot z\right)} \]
      3. *-lft-identity91.5%

        \[\leadsto \color{blue}{\cos y \cdot z} \]
    6. Simplified91.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2500:\\ \;\;\;\;x + z\\ \mathbf{elif}\;x \leq 3.1 \cdot 10^{-262}:\\ \;\;\;\;\sin y + z\\ \mathbf{elif}\;x \leq 3.3 \cdot 10^{-227}:\\ \;\;\;\;z \cdot \cos y\\ \mathbf{elif}\;x \leq 3.5 \cdot 10^{-9}:\\ \;\;\;\;\sin y + z\\ \mathbf{else}:\\ \;\;\;\;x + z\\ \end{array} \]

Alternative 4: 84.8% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \cos y\\ \mathbf{if}\;z \leq -1.05 \cdot 10^{+103}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -2.1 \cdot 10^{-17}:\\ \;\;\;\;x + z\\ \mathbf{elif}\;z \leq 1.25 \cdot 10^{-59}:\\ \;\;\;\;x + \sin y\\ \mathbf{elif}\;z \leq 1.38 \cdot 10^{+181}:\\ \;\;\;\;x + z\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* z (cos y))))
   (if (<= z -1.05e+103)
     t_0
     (if (<= z -2.1e-17)
       (+ x z)
       (if (<= z 1.25e-59) (+ x (sin y)) (if (<= z 1.38e+181) (+ x z) t_0))))))
double code(double x, double y, double z) {
	double t_0 = z * cos(y);
	double tmp;
	if (z <= -1.05e+103) {
		tmp = t_0;
	} else if (z <= -2.1e-17) {
		tmp = x + z;
	} else if (z <= 1.25e-59) {
		tmp = x + sin(y);
	} else if (z <= 1.38e+181) {
		tmp = x + z;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = z * cos(y)
    if (z <= (-1.05d+103)) then
        tmp = t_0
    else if (z <= (-2.1d-17)) then
        tmp = x + z
    else if (z <= 1.25d-59) then
        tmp = x + sin(y)
    else if (z <= 1.38d+181) then
        tmp = x + z
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = z * Math.cos(y);
	double tmp;
	if (z <= -1.05e+103) {
		tmp = t_0;
	} else if (z <= -2.1e-17) {
		tmp = x + z;
	} else if (z <= 1.25e-59) {
		tmp = x + Math.sin(y);
	} else if (z <= 1.38e+181) {
		tmp = x + z;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = z * math.cos(y)
	tmp = 0
	if z <= -1.05e+103:
		tmp = t_0
	elif z <= -2.1e-17:
		tmp = x + z
	elif z <= 1.25e-59:
		tmp = x + math.sin(y)
	elif z <= 1.38e+181:
		tmp = x + z
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(z * cos(y))
	tmp = 0.0
	if (z <= -1.05e+103)
		tmp = t_0;
	elseif (z <= -2.1e-17)
		tmp = Float64(x + z);
	elseif (z <= 1.25e-59)
		tmp = Float64(x + sin(y));
	elseif (z <= 1.38e+181)
		tmp = Float64(x + z);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = z * cos(y);
	tmp = 0.0;
	if (z <= -1.05e+103)
		tmp = t_0;
	elseif (z <= -2.1e-17)
		tmp = x + z;
	elseif (z <= 1.25e-59)
		tmp = x + sin(y);
	elseif (z <= 1.38e+181)
		tmp = x + z;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.05e+103], t$95$0, If[LessEqual[z, -2.1e-17], N[(x + z), $MachinePrecision], If[LessEqual[z, 1.25e-59], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.38e+181], N[(x + z), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -1.05 \cdot 10^{+103}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq -2.1 \cdot 10^{-17}:\\
\;\;\;\;x + z\\

\mathbf{elif}\;z \leq 1.25 \cdot 10^{-59}:\\
\;\;\;\;x + \sin y\\

\mathbf{elif}\;z \leq 1.38 \cdot 10^{+181}:\\
\;\;\;\;x + z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.0500000000000001e103 or 1.3799999999999999e181 < z

    1. Initial program 99.8%

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

        \[\leadsto \color{blue}{z \cdot \cos y + \left(x + \sin y\right)} \]
      2. add-cube-cbrt99.1%

        \[\leadsto z \cdot \color{blue}{\left(\left(\sqrt[3]{\cos y} \cdot \sqrt[3]{\cos y}\right) \cdot \sqrt[3]{\cos y}\right)} + \left(x + \sin y\right) \]
      3. associate-*r*99.1%

        \[\leadsto \color{blue}{\left(z \cdot \left(\sqrt[3]{\cos y} \cdot \sqrt[3]{\cos y}\right)\right) \cdot \sqrt[3]{\cos y}} + \left(x + \sin y\right) \]
      4. fma-def99.1%

        \[\leadsto \color{blue}{\mathsf{fma}\left(z \cdot \left(\sqrt[3]{\cos y} \cdot \sqrt[3]{\cos y}\right), \sqrt[3]{\cos y}, x + \sin y\right)} \]
      5. pow299.1%

        \[\leadsto \mathsf{fma}\left(z \cdot \color{blue}{{\left(\sqrt[3]{\cos y}\right)}^{2}}, \sqrt[3]{\cos y}, x + \sin y\right) \]
    3. Applied egg-rr99.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(z \cdot {\left(\sqrt[3]{\cos y}\right)}^{2}, \sqrt[3]{\cos y}, x + \sin y\right)} \]
    4. Taylor expanded in z around inf 92.1%

      \[\leadsto \color{blue}{{1}^{0.3333333333333333} \cdot \left(z \cdot \cos y\right)} \]
    5. Step-by-step derivation
      1. pow-base-192.1%

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

        \[\leadsto 1 \cdot \color{blue}{\left(\cos y \cdot z\right)} \]
      3. *-lft-identity92.1%

        \[\leadsto \color{blue}{\cos y \cdot z} \]
    6. Simplified92.1%

      \[\leadsto \color{blue}{\cos y \cdot z} \]

    if -1.0500000000000001e103 < z < -2.09999999999999992e-17 or 1.25e-59 < z < 1.3799999999999999e181

    1. Initial program 100.0%

      \[\left(x + \sin y\right) + z \cdot \cos y \]
    2. Taylor expanded in y around 0 83.8%

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

    if -2.09999999999999992e-17 < z < 1.25e-59

    1. Initial program 100.0%

      \[\left(x + \sin y\right) + z \cdot \cos y \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \color{blue}{z \cdot \cos y + \left(x + \sin y\right)} \]
      2. add-cube-cbrt100.0%

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

        \[\leadsto \color{blue}{\left(z \cdot \left(\sqrt[3]{\cos y} \cdot \sqrt[3]{\cos y}\right)\right) \cdot \sqrt[3]{\cos y}} + \left(x + \sin y\right) \]
      4. fma-def100.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(z \cdot \left(\sqrt[3]{\cos y} \cdot \sqrt[3]{\cos y}\right), \sqrt[3]{\cos y}, x + \sin y\right)} \]
      5. pow2100.0%

        \[\leadsto \mathsf{fma}\left(z \cdot \color{blue}{{\left(\sqrt[3]{\cos y}\right)}^{2}}, \sqrt[3]{\cos y}, x + \sin y\right) \]
    3. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(z \cdot {\left(\sqrt[3]{\cos y}\right)}^{2}, \sqrt[3]{\cos y}, x + \sin y\right)} \]
    4. Taylor expanded in z around 0 94.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.05 \cdot 10^{+103}:\\ \;\;\;\;z \cdot \cos y\\ \mathbf{elif}\;z \leq -2.1 \cdot 10^{-17}:\\ \;\;\;\;x + z\\ \mathbf{elif}\;z \leq 1.25 \cdot 10^{-59}:\\ \;\;\;\;x + \sin y\\ \mathbf{elif}\;z \leq 1.38 \cdot 10^{+181}:\\ \;\;\;\;x + z\\ \mathbf{else}:\\ \;\;\;\;z \cdot \cos y\\ \end{array} \]

Alternative 5: 95.2% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -4.1 \cdot 10^{-18} \lor \neg \left(z \leq 8.5 \cdot 10^{-60}\right):\\ \;\;\;\;x + z \cdot \cos y\\ \mathbf{else}:\\ \;\;\;\;x + \sin y\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= z -4.1e-18) (not (<= z 8.5e-60)))
   (+ x (* z (cos y)))
   (+ x (sin y))))
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -4.1e-18) || !(z <= 8.5e-60)) {
		tmp = x + (z * cos(y));
	} else {
		tmp = x + sin(y);
	}
	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 <= (-4.1d-18)) .or. (.not. (z <= 8.5d-60))) then
        tmp = x + (z * cos(y))
    else
        tmp = x + sin(y)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((z <= -4.1e-18) || !(z <= 8.5e-60)) {
		tmp = x + (z * Math.cos(y));
	} else {
		tmp = x + Math.sin(y);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (z <= -4.1e-18) or not (z <= 8.5e-60):
		tmp = x + (z * math.cos(y))
	else:
		tmp = x + math.sin(y)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((z <= -4.1e-18) || !(z <= 8.5e-60))
		tmp = Float64(x + Float64(z * cos(y)));
	else
		tmp = Float64(x + sin(y));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((z <= -4.1e-18) || ~((z <= 8.5e-60)))
		tmp = x + (z * cos(y));
	else
		tmp = x + sin(y);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[z, -4.1e-18], N[Not[LessEqual[z, 8.5e-60]], $MachinePrecision]], N[(x + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.1 \cdot 10^{-18} \lor \neg \left(z \leq 8.5 \cdot 10^{-60}\right):\\
\;\;\;\;x + z \cdot \cos y\\

\mathbf{else}:\\
\;\;\;\;x + \sin y\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -4.0999999999999998e-18 or 8.50000000000000044e-60 < z

    1. Initial program 99.9%

      \[\left(x + \sin y\right) + z \cdot \cos y \]
    2. Taylor expanded in x around inf 98.4%

      \[\leadsto \color{blue}{x} + z \cdot \cos y \]

    if -4.0999999999999998e-18 < z < 8.50000000000000044e-60

    1. Initial program 100.0%

      \[\left(x + \sin y\right) + z \cdot \cos y \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \color{blue}{z \cdot \cos y + \left(x + \sin y\right)} \]
      2. add-cube-cbrt100.0%

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

        \[\leadsto \color{blue}{\left(z \cdot \left(\sqrt[3]{\cos y} \cdot \sqrt[3]{\cos y}\right)\right) \cdot \sqrt[3]{\cos y}} + \left(x + \sin y\right) \]
      4. fma-def100.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(z \cdot \left(\sqrt[3]{\cos y} \cdot \sqrt[3]{\cos y}\right), \sqrt[3]{\cos y}, x + \sin y\right)} \]
      5. pow2100.0%

        \[\leadsto \mathsf{fma}\left(z \cdot \color{blue}{{\left(\sqrt[3]{\cos y}\right)}^{2}}, \sqrt[3]{\cos y}, x + \sin y\right) \]
    3. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(z \cdot {\left(\sqrt[3]{\cos y}\right)}^{2}, \sqrt[3]{\cos y}, x + \sin y\right)} \]
    4. Taylor expanded in z around 0 94.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4.1 \cdot 10^{-18} \lor \neg \left(z \leq 8.5 \cdot 10^{-60}\right):\\ \;\;\;\;x + z \cdot \cos y\\ \mathbf{else}:\\ \;\;\;\;x + \sin y\\ \end{array} \]

Alternative 6: 98.7% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -700000000000 \lor \neg \left(z \leq 3.2 \cdot 10^{-32}\right):\\
\;\;\;\;x + z \cdot \cos y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -7e11 or 3.2000000000000002e-32 < z

    1. Initial program 99.9%

      \[\left(x + \sin y\right) + z \cdot \cos y \]
    2. Taylor expanded in x around inf 99.7%

      \[\leadsto \color{blue}{x} + z \cdot \cos y \]

    if -7e11 < z < 3.2000000000000002e-32

    1. Initial program 100.0%

      \[\left(x + \sin y\right) + z \cdot \cos y \]
    2. Taylor expanded in y around 0 100.0%

      \[\leadsto \left(x + \sin y\right) + \color{blue}{z} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -700000000000 \lor \neg \left(z \leq 3.2 \cdot 10^{-32}\right):\\ \;\;\;\;x + z \cdot \cos y\\ \mathbf{else}:\\ \;\;\;\;z + \left(x + \sin y\right)\\ \end{array} \]

Alternative 7: 70.2% accurate, 22.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -90000:\\
\;\;\;\;x + z\\

\mathbf{elif}\;y \leq 3.4 \cdot 10^{+62}:\\
\;\;\;\;y + \left(x + z\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -9e4 or 3.40000000000000014e62 < y

    1. Initial program 99.9%

      \[\left(x + \sin y\right) + z \cdot \cos y \]
    2. Taylor expanded in y around 0 41.9%

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

    if -9e4 < y < 3.40000000000000014e62

    1. Initial program 99.9%

      \[\left(x + \sin y\right) + z \cdot \cos y \]
    2. Taylor expanded in y around 0 90.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -90000:\\ \;\;\;\;x + z\\ \mathbf{elif}\;y \leq 3.4 \cdot 10^{+62}:\\ \;\;\;\;y + \left(x + z\right)\\ \mathbf{else}:\\ \;\;\;\;x + z\\ \end{array} \]

Alternative 8: 58.9% accurate, 29.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2500:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 95000:\\ \;\;\;\;y + z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= x -2500.0) x (if (<= x 95000.0) (+ y z) x)))
double code(double x, double y, double z) {
	double tmp;
	if (x <= -2500.0) {
		tmp = x;
	} else if (x <= 95000.0) {
		tmp = y + 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 (x <= (-2500.0d0)) then
        tmp = x
    else if (x <= 95000.0d0) then
        tmp = y + z
    else
        tmp = x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (x <= -2500.0) {
		tmp = x;
	} else if (x <= 95000.0) {
		tmp = y + z;
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if x <= -2500.0:
		tmp = x
	elif x <= 95000.0:
		tmp = y + z
	else:
		tmp = x
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (x <= -2500.0)
		tmp = x;
	elseif (x <= 95000.0)
		tmp = Float64(y + z);
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (x <= -2500.0)
		tmp = x;
	elseif (x <= 95000.0)
		tmp = y + z;
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[x, -2500.0], x, If[LessEqual[x, 95000.0], N[(y + z), $MachinePrecision], x]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2500:\\
\;\;\;\;x\\

\mathbf{elif}\;x \leq 95000:\\
\;\;\;\;y + z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2500 or 95000 < x

    1. Initial program 100.0%

      \[\left(x + \sin y\right) + z \cdot \cos y \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \color{blue}{z \cdot \cos y + \left(x + \sin y\right)} \]
      2. add-cube-cbrt99.8%

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

        \[\leadsto \color{blue}{\left(z \cdot \left(\sqrt[3]{\cos y} \cdot \sqrt[3]{\cos y}\right)\right) \cdot \sqrt[3]{\cos y}} + \left(x + \sin y\right) \]
      4. fma-def99.7%

        \[\leadsto \color{blue}{\mathsf{fma}\left(z \cdot \left(\sqrt[3]{\cos y} \cdot \sqrt[3]{\cos y}\right), \sqrt[3]{\cos y}, x + \sin y\right)} \]
      5. pow299.7%

        \[\leadsto \mathsf{fma}\left(z \cdot \color{blue}{{\left(\sqrt[3]{\cos y}\right)}^{2}}, \sqrt[3]{\cos y}, x + \sin y\right) \]
    3. Applied egg-rr99.7%

      \[\leadsto \color{blue}{\mathsf{fma}\left(z \cdot {\left(\sqrt[3]{\cos y}\right)}^{2}, \sqrt[3]{\cos y}, x + \sin y\right)} \]
    4. Taylor expanded in x around inf 72.3%

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

    if -2500 < x < 95000

    1. Initial program 99.9%

      \[\left(x + \sin y\right) + z \cdot \cos y \]
    2. Taylor expanded in x around 0 93.9%

      \[\leadsto \color{blue}{z \cdot \cos y + \sin y} \]
    3. Taylor expanded in y around 0 51.5%

      \[\leadsto \color{blue}{y + z} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification60.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2500:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 95000:\\ \;\;\;\;y + z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 9: 67.7% accurate, 29.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.8 \cdot 10^{-49}:\\
\;\;\;\;x + z\\

\mathbf{elif}\;x \leq 2.25 \cdot 10^{-149}:\\
\;\;\;\;y + z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -5.8e-49 or 2.2499999999999999e-149 < x

    1. Initial program 99.9%

      \[\left(x + \sin y\right) + z \cdot \cos y \]
    2. Taylor expanded in y around 0 76.8%

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

    if -5.8e-49 < x < 2.2499999999999999e-149

    1. Initial program 99.9%

      \[\left(x + \sin y\right) + z \cdot \cos y \]
    2. Taylor expanded in x around 0 97.3%

      \[\leadsto \color{blue}{z \cdot \cos y + \sin y} \]
    3. Taylor expanded in y around 0 54.7%

      \[\leadsto \color{blue}{y + z} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification67.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -5.8 \cdot 10^{-49}:\\ \;\;\;\;x + z\\ \mathbf{elif}\;x \leq 2.25 \cdot 10^{-149}:\\ \;\;\;\;y + z\\ \mathbf{else}:\\ \;\;\;\;x + z\\ \end{array} \]

Alternative 10: 55.8% accurate, 40.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2500:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 225000:\\ \;\;\;\;z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= x -2500.0) x (if (<= x 225000.0) z x)))
double code(double x, double y, double z) {
	double tmp;
	if (x <= -2500.0) {
		tmp = x;
	} else if (x <= 225000.0) {
		tmp = 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 (x <= (-2500.0d0)) then
        tmp = x
    else if (x <= 225000.0d0) then
        tmp = z
    else
        tmp = x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (x <= -2500.0) {
		tmp = x;
	} else if (x <= 225000.0) {
		tmp = z;
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if x <= -2500.0:
		tmp = x
	elif x <= 225000.0:
		tmp = z
	else:
		tmp = x
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (x <= -2500.0)
		tmp = x;
	elseif (x <= 225000.0)
		tmp = z;
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (x <= -2500.0)
		tmp = x;
	elseif (x <= 225000.0)
		tmp = z;
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[x, -2500.0], x, If[LessEqual[x, 225000.0], z, x]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2500:\\
\;\;\;\;x\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2500 or 225000 < x

    1. Initial program 100.0%

      \[\left(x + \sin y\right) + z \cdot \cos y \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \color{blue}{z \cdot \cos y + \left(x + \sin y\right)} \]
      2. add-cube-cbrt99.8%

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

        \[\leadsto \color{blue}{\left(z \cdot \left(\sqrt[3]{\cos y} \cdot \sqrt[3]{\cos y}\right)\right) \cdot \sqrt[3]{\cos y}} + \left(x + \sin y\right) \]
      4. fma-def99.7%

        \[\leadsto \color{blue}{\mathsf{fma}\left(z \cdot \left(\sqrt[3]{\cos y} \cdot \sqrt[3]{\cos y}\right), \sqrt[3]{\cos y}, x + \sin y\right)} \]
      5. pow299.7%

        \[\leadsto \mathsf{fma}\left(z \cdot \color{blue}{{\left(\sqrt[3]{\cos y}\right)}^{2}}, \sqrt[3]{\cos y}, x + \sin y\right) \]
    3. Applied egg-rr99.7%

      \[\leadsto \color{blue}{\mathsf{fma}\left(z \cdot {\left(\sqrt[3]{\cos y}\right)}^{2}, \sqrt[3]{\cos y}, x + \sin y\right)} \]
    4. Taylor expanded in x around inf 72.3%

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

    if -2500 < x < 225000

    1. Initial program 99.9%

      \[\left(x + \sin y\right) + z \cdot \cos y \]
    2. Taylor expanded in x around 0 93.9%

      \[\leadsto \color{blue}{z \cdot \cos y + \sin y} \]
    3. Taylor expanded in y around 0 76.6%

      \[\leadsto \color{blue}{z} + \sin y \]
    4. Taylor expanded in z around inf 38.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2500:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 225000:\\ \;\;\;\;z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

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

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

      \[\leadsto \color{blue}{z \cdot \cos y + \left(x + \sin y\right)} \]
    2. add-cube-cbrt99.7%

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

      \[\leadsto \color{blue}{\left(z \cdot \left(\sqrt[3]{\cos y} \cdot \sqrt[3]{\cos y}\right)\right) \cdot \sqrt[3]{\cos y}} + \left(x + \sin y\right) \]
    4. fma-def99.7%

      \[\leadsto \color{blue}{\mathsf{fma}\left(z \cdot \left(\sqrt[3]{\cos y} \cdot \sqrt[3]{\cos y}\right), \sqrt[3]{\cos y}, x + \sin y\right)} \]
    5. pow299.7%

      \[\leadsto \mathsf{fma}\left(z \cdot \color{blue}{{\left(\sqrt[3]{\cos y}\right)}^{2}}, \sqrt[3]{\cos y}, x + \sin y\right) \]
  3. Applied egg-rr99.7%

    \[\leadsto \color{blue}{\mathsf{fma}\left(z \cdot {\left(\sqrt[3]{\cos y}\right)}^{2}, \sqrt[3]{\cos y}, x + \sin y\right)} \]
  4. Taylor expanded in x around inf 36.3%

    \[\leadsto \color{blue}{x} \]
  5. Final simplification36.3%

    \[\leadsto x \]

Reproduce

?
herbie shell --seed 2023216 
(FPCore (x y z)
  :name "Graphics.Rasterific.Svg.PathConverter:segmentToBezier from rasterific-svg-0.2.3.1, C"
  :precision binary64
  (+ (+ x (sin y)) (* z (cos y))))