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

Percentage Accurate: 99.9% → 99.9%
Time: 6.8s
Alternatives: 13
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 13 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} \\ \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}
Derivation
  1. Initial program 99.9%

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

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

Alternative 2: 71.2% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \cos y\\ \mathbf{if}\;z \leq -3 \cdot 10^{+209}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1.06 \cdot 10^{-211}:\\ \;\;\;\;x + z\\ \mathbf{elif}\;z \leq 6.8 \cdot 10^{-177}:\\ \;\;\;\;\sin y + z\\ \mathbf{elif}\;z \leq 3.7 \cdot 10^{+101}:\\ \;\;\;\;x + z\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* z (cos y))))
   (if (<= z -3e+209)
     t_0
     (if (<= z 1.06e-211)
       (+ x z)
       (if (<= z 6.8e-177) (+ (sin y) z) (if (<= z 3.7e+101) (+ x z) t_0))))))
double code(double x, double y, double z) {
	double t_0 = z * cos(y);
	double tmp;
	if (z <= -3e+209) {
		tmp = t_0;
	} else if (z <= 1.06e-211) {
		tmp = x + z;
	} else if (z <= 6.8e-177) {
		tmp = sin(y) + z;
	} else if (z <= 3.7e+101) {
		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 <= (-3d+209)) then
        tmp = t_0
    else if (z <= 1.06d-211) then
        tmp = x + z
    else if (z <= 6.8d-177) then
        tmp = sin(y) + z
    else if (z <= 3.7d+101) 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 <= -3e+209) {
		tmp = t_0;
	} else if (z <= 1.06e-211) {
		tmp = x + z;
	} else if (z <= 6.8e-177) {
		tmp = Math.sin(y) + z;
	} else if (z <= 3.7e+101) {
		tmp = x + z;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = z * math.cos(y)
	tmp = 0
	if z <= -3e+209:
		tmp = t_0
	elif z <= 1.06e-211:
		tmp = x + z
	elif z <= 6.8e-177:
		tmp = math.sin(y) + z
	elif z <= 3.7e+101:
		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 <= -3e+209)
		tmp = t_0;
	elseif (z <= 1.06e-211)
		tmp = Float64(x + z);
	elseif (z <= 6.8e-177)
		tmp = Float64(sin(y) + z);
	elseif (z <= 3.7e+101)
		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 <= -3e+209)
		tmp = t_0;
	elseif (z <= 1.06e-211)
		tmp = x + z;
	elseif (z <= 6.8e-177)
		tmp = sin(y) + z;
	elseif (z <= 3.7e+101)
		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, -3e+209], t$95$0, If[LessEqual[z, 1.06e-211], N[(x + z), $MachinePrecision], If[LessEqual[z, 6.8e-177], N[(N[Sin[y], $MachinePrecision] + z), $MachinePrecision], If[LessEqual[z, 3.7e+101], N[(x + z), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq 1.06 \cdot 10^{-211}:\\
\;\;\;\;x + z\\

\mathbf{elif}\;z \leq 6.8 \cdot 10^{-177}:\\
\;\;\;\;\sin y + z\\

\mathbf{elif}\;z \leq 3.7 \cdot 10^{+101}:\\
\;\;\;\;x + z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -2.99999999999999985e209 or 3.6999999999999997e101 < z

    1. Initial program 99.9%

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

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

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

    if -2.99999999999999985e209 < z < 1.0600000000000001e-211 or 6.8000000000000001e-177 < z < 3.6999999999999997e101

    1. Initial program 100.0%

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

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

    if 1.0600000000000001e-211 < z < 6.8000000000000001e-177

    1. Initial program 100.0%

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

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

      \[\leadsto \color{blue}{z} + \sin y \]
  3. Recombined 3 regimes into one program.
  4. Final simplification80.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3 \cdot 10^{+209}:\\ \;\;\;\;z \cdot \cos y\\ \mathbf{elif}\;z \leq 1.06 \cdot 10^{-211}:\\ \;\;\;\;x + z\\ \mathbf{elif}\;z \leq 6.8 \cdot 10^{-177}:\\ \;\;\;\;\sin y + z\\ \mathbf{elif}\;z \leq 3.7 \cdot 10^{+101}:\\ \;\;\;\;x + z\\ \mathbf{else}:\\ \;\;\;\;z \cdot \cos y\\ \end{array} \]

Alternative 3: 83.1% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \cos y\\ \mathbf{if}\;z \leq -1.22 \cdot 10^{+209}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.52 \cdot 10^{-96}:\\ \;\;\;\;x + z\\ \mathbf{elif}\;z \leq 650000:\\ \;\;\;\;x + \sin y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* z (cos y))))
   (if (<= z -1.22e+209)
     t_0
     (if (<= z -1.52e-96) (+ x z) (if (<= z 650000.0) (+ x (sin y)) t_0)))))
double code(double x, double y, double z) {
	double t_0 = z * cos(y);
	double tmp;
	if (z <= -1.22e+209) {
		tmp = t_0;
	} else if (z <= -1.52e-96) {
		tmp = x + z;
	} else if (z <= 650000.0) {
		tmp = x + sin(y);
	} 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.22d+209)) then
        tmp = t_0
    else if (z <= (-1.52d-96)) then
        tmp = x + z
    else if (z <= 650000.0d0) then
        tmp = x + sin(y)
    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.22e+209) {
		tmp = t_0;
	} else if (z <= -1.52e-96) {
		tmp = x + z;
	} else if (z <= 650000.0) {
		tmp = x + Math.sin(y);
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = z * math.cos(y)
	tmp = 0
	if z <= -1.22e+209:
		tmp = t_0
	elif z <= -1.52e-96:
		tmp = x + z
	elif z <= 650000.0:
		tmp = x + math.sin(y)
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(z * cos(y))
	tmp = 0.0
	if (z <= -1.22e+209)
		tmp = t_0;
	elseif (z <= -1.52e-96)
		tmp = Float64(x + z);
	elseif (z <= 650000.0)
		tmp = Float64(x + sin(y));
	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.22e+209)
		tmp = t_0;
	elseif (z <= -1.52e-96)
		tmp = x + z;
	elseif (z <= 650000.0)
		tmp = x + sin(y);
	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.22e+209], t$95$0, If[LessEqual[z, -1.52e-96], N[(x + z), $MachinePrecision], If[LessEqual[z, 650000.0], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -1.52 \cdot 10^{-96}:\\
\;\;\;\;x + z\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.21999999999999995e209 or 6.5e5 < 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 \]
    3. Taylor expanded in x around 0 90.1%

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

    if -1.21999999999999995e209 < z < -1.52e-96

    1. Initial program 99.9%

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

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

    if -1.52e-96 < z < 6.5e5

    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. *-commutative100.0%

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

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

        \[\leadsto \color{blue}{\left(\cos y \cdot \sqrt{z}\right) \cdot \sqrt{z}} + \left(x + \sin y\right) \]
      5. fma-def67.2%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.22 \cdot 10^{+209}:\\ \;\;\;\;z \cdot \cos y\\ \mathbf{elif}\;z \leq -1.52 \cdot 10^{-96}:\\ \;\;\;\;x + z\\ \mathbf{elif}\;z \leq 650000:\\ \;\;\;\;x + \sin y\\ \mathbf{else}:\\ \;\;\;\;z \cdot \cos y\\ \end{array} \]

Alternative 4: 94.6% accurate, 1.9× speedup?

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

    1. Initial program 99.9%

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

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

    if -6.40000000000000023e-96 < z < 5.2000000000000003e-63

    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. *-commutative100.0%

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

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

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

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

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

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

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

Alternative 5: 99.2% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -80000000 \lor \neg \left(z \leq 1.6 \cdot 10^{-5}\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 -80000000.0) (not (<= z 1.6e-5)))
   (+ x (* z (cos y)))
   (+ z (+ x (sin y)))))
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -80000000.0) || !(z <= 1.6e-5)) {
		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 <= (-80000000.0d0)) .or. (.not. (z <= 1.6d-5))) 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 <= -80000000.0) || !(z <= 1.6e-5)) {
		tmp = x + (z * Math.cos(y));
	} else {
		tmp = z + (x + Math.sin(y));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (z <= -80000000.0) or not (z <= 1.6e-5):
		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 <= -80000000.0) || !(z <= 1.6e-5))
		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 <= -80000000.0) || ~((z <= 1.6e-5)))
		tmp = x + (z * cos(y));
	else
		tmp = z + (x + sin(y));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[z, -80000000.0], N[Not[LessEqual[z, 1.6e-5]], $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 -80000000 \lor \neg \left(z \leq 1.6 \cdot 10^{-5}\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 < -8e7 or 1.59999999999999993e-5 < z

    1. Initial program 99.9%

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

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

    if -8e7 < z < 1.59999999999999993e-5

    1. Initial program 100.0%

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

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

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

Alternative 6: 69.8% accurate, 1.9× speedup?

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

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

\mathbf{elif}\;y \leq 27500:\\
\;\;\;\;z + \left(x + y\right)\\

\mathbf{elif}\;y \leq 9 \cdot 10^{+69}:\\
\;\;\;\;\sin y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -7e12 or 8.9999999999999999e69 < y

    1. Initial program 99.9%

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

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

    if -7e12 < y < 27500

    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. *-commutative100.0%

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

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

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

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

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

      \[\leadsto \color{blue}{y + \left(z + x\right)} \]
    5. Step-by-step derivation
      1. associate-+r+98.3%

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

        \[\leadsto \color{blue}{\left(z + y\right)} + x \]
      3. associate-+l+98.4%

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

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

    if 27500 < y < 8.9999999999999999e69

    1. Initial program 99.8%

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

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

      \[\leadsto \color{blue}{\sin y} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification74.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -7000000000000:\\ \;\;\;\;x + z\\ \mathbf{elif}\;y \leq 27500:\\ \;\;\;\;z + \left(x + y\right)\\ \mathbf{elif}\;y \leq 9 \cdot 10^{+69}:\\ \;\;\;\;\sin y\\ \mathbf{else}:\\ \;\;\;\;x + z\\ \end{array} \]

Alternative 7: 71.8% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.5 \cdot 10^{+209} \lor \neg \left(z \leq 3.7 \cdot 10^{+101}\right):\\
\;\;\;\;z \cdot \cos y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.49999999999999982e209 or 3.6999999999999997e101 < z

    1. Initial program 99.9%

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

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

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

    if -2.49999999999999982e209 < z < 3.6999999999999997e101

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.5 \cdot 10^{+209} \lor \neg \left(z \leq 3.7 \cdot 10^{+101}\right):\\ \;\;\;\;z \cdot \cos y\\ \mathbf{else}:\\ \;\;\;\;x + z\\ \end{array} \]

Alternative 8: 69.9% accurate, 22.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.4 \cdot 10^{+15}:\\
\;\;\;\;x + z\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.4e15 or 8.9999999999999999e69 < y

    1. Initial program 99.9%

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

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

    if -3.4e15 < y < 8.9999999999999999e69

    1. Initial program 100.0%

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

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

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

Alternative 9: 69.9% accurate, 22.7× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -7.5e12 or 9.20000000000000067e69 < y

    1. Initial program 99.9%

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

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

    if -7.5e12 < y < 9.20000000000000067e69

    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. *-commutative100.0%

        \[\leadsto \color{blue}{\cos y \cdot z} + \left(x + \sin y\right) \]
      3. add-sqr-sqrt53.4%

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

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

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

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

      \[\leadsto \color{blue}{y + \left(z + x\right)} \]
    5. Step-by-step derivation
      1. associate-+r+92.7%

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

        \[\leadsto \color{blue}{\left(z + y\right)} + x \]
      3. associate-+l+92.7%

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

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

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

Alternative 10: 67.4% accurate, 29.1× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -4.6000000000000002e-169 or 1.5500000000000001e-216 < x

    1. Initial program 100.0%

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

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

    if -4.6000000000000002e-169 < x < 1.5500000000000001e-216

    1. Initial program 99.9%

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

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

      \[\leadsto \color{blue}{y + z} \]
    4. Step-by-step derivation
      1. +-commutative64.4%

        \[\leadsto \color{blue}{z + y} \]
    5. Simplified64.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4.6 \cdot 10^{-169}:\\ \;\;\;\;x + z\\ \mathbf{elif}\;x \leq 1.55 \cdot 10^{-216}:\\ \;\;\;\;y + z\\ \mathbf{else}:\\ \;\;\;\;x + z\\ \end{array} \]

Alternative 11: 53.9% accurate, 40.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2 \cdot 10^{-31}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1.42 \cdot 10^{-61}:\\ \;\;\;\;z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= x -2e-31) x (if (<= x 1.42e-61) z x)))
double code(double x, double y, double z) {
	double tmp;
	if (x <= -2e-31) {
		tmp = x;
	} else if (x <= 1.42e-61) {
		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 <= (-2d-31)) then
        tmp = x
    else if (x <= 1.42d-61) 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 <= -2e-31) {
		tmp = x;
	} else if (x <= 1.42e-61) {
		tmp = z;
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if x <= -2e-31:
		tmp = x
	elif x <= 1.42e-61:
		tmp = z
	else:
		tmp = x
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (x <= -2e-31)
		tmp = x;
	elseif (x <= 1.42e-61)
		tmp = z;
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (x <= -2e-31)
		tmp = x;
	elseif (x <= 1.42e-61)
		tmp = z;
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[x, -2e-31], x, If[LessEqual[x, 1.42e-61], z, x]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{-31}:\\
\;\;\;\;x\\

\mathbf{elif}\;x \leq 1.42 \cdot 10^{-61}:\\
\;\;\;\;z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2e-31 or 1.42e-61 < x

    1. Initial program 99.9%

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

      \[\leadsto \color{blue}{x} + z \cdot \cos y \]
    3. Taylor expanded in x around inf 69.5%

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

    if -2e-31 < x < 1.42e-61

    1. Initial program 99.9%

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

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

      \[\leadsto \color{blue}{\cos y \cdot z} \]
    4. Taylor expanded in y around 0 46.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2 \cdot 10^{-31}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1.42 \cdot 10^{-61}:\\ \;\;\;\;z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 12: 65.5% accurate, 69.0× speedup?

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

\\
x + z
\end{array}
Derivation
  1. Initial program 99.9%

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

    \[\leadsto \color{blue}{z + x} \]
  3. Final simplification68.5%

    \[\leadsto x + z \]

Alternative 13: 42.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. Taylor expanded in x around inf 84.4%

    \[\leadsto \color{blue}{x} + z \cdot \cos y \]
  3. Taylor expanded in x around inf 42.9%

    \[\leadsto \color{blue}{x} \]
  4. Final simplification42.9%

    \[\leadsto x \]

Reproduce

?
herbie shell --seed 2023174 
(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))))