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

Percentage Accurate: 99.9% → 99.9%
Time: 8.2s
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, 0.7× speedup?

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

\\
\mathsf{fma}\left(z, \cos y, x + \sin y\right)
\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. fma-define99.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(z, \cos y, x + \sin y\right)} \]
  3. Simplified99.9%

    \[\leadsto \color{blue}{\mathsf{fma}\left(z, \cos y, x + \sin y\right)} \]
  4. Add Preprocessing
  5. Add Preprocessing

Alternative 2: 98.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -3.6 \cdot 10^{+32}:\\ \;\;\;\;\mathsf{fma}\left(z, \cos y, x\right)\\ \mathbf{elif}\;z \leq 7.8 \cdot 10^{-5}:\\ \;\;\;\;z + \left(x + \sin y\right)\\ \mathbf{else}:\\ \;\;\;\;x + z \cdot \cos y\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= z -3.6e+32)
   (fma z (cos y) x)
   (if (<= z 7.8e-5) (+ z (+ x (sin y))) (+ x (* z (cos y))))))
double code(double x, double y, double z) {
	double tmp;
	if (z <= -3.6e+32) {
		tmp = fma(z, cos(y), x);
	} else if (z <= 7.8e-5) {
		tmp = z + (x + sin(y));
	} else {
		tmp = x + (z * cos(y));
	}
	return tmp;
}
function code(x, y, z)
	tmp = 0.0
	if (z <= -3.6e+32)
		tmp = fma(z, cos(y), x);
	elseif (z <= 7.8e-5)
		tmp = Float64(z + Float64(x + sin(y)));
	else
		tmp = Float64(x + Float64(z * cos(y)));
	end
	return tmp
end
code[x_, y_, z_] := If[LessEqual[z, -3.6e+32], N[(z * N[Cos[y], $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 7.8e-5], N[(z + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.6 \cdot 10^{+32}:\\
\;\;\;\;\mathsf{fma}\left(z, \cos y, x\right)\\

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

\mathbf{else}:\\
\;\;\;\;x + z \cdot \cos y\\


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

    1. Initial program 99.7%

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(z, \cos y, x + \sin y\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 99.7%

      \[\leadsto \mathsf{fma}\left(z, \cos y, \color{blue}{x}\right) \]

    if -3.5999999999999997e32 < z < 7.7999999999999999e-5

    1. Initial program 100.0%

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

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

    if 7.7999999999999999e-5 < z

    1. Initial program 99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.6 \cdot 10^{+32}:\\ \;\;\;\;\mathsf{fma}\left(z, \cos y, x\right)\\ \mathbf{elif}\;z \leq 7.8 \cdot 10^{-5}:\\ \;\;\;\;z + \left(x + \sin y\right)\\ \mathbf{else}:\\ \;\;\;\;x + z \cdot \cos y\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 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. Add Preprocessing
  3. Add Preprocessing

Alternative 4: 73.4% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \cos y\\ \mathbf{if}\;z \leq -9.6 \cdot 10^{+32}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 6 \cdot 10^{-294}:\\ \;\;\;\;z + x\\ \mathbf{elif}\;z \leq 2.2 \cdot 10^{-210}:\\ \;\;\;\;z + \left(y + x\right)\\ \mathbf{elif}\;z \leq 7 \cdot 10^{+127}:\\ \;\;\;\;z + x\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* z (cos y))))
   (if (<= z -9.6e+32)
     t_0
     (if (<= z 6e-294)
       (+ z x)
       (if (<= z 2.2e-210) (+ z (+ y x)) (if (<= z 7e+127) (+ z x) t_0))))))
double code(double x, double y, double z) {
	double t_0 = z * cos(y);
	double tmp;
	if (z <= -9.6e+32) {
		tmp = t_0;
	} else if (z <= 6e-294) {
		tmp = z + x;
	} else if (z <= 2.2e-210) {
		tmp = z + (y + x);
	} else if (z <= 7e+127) {
		tmp = z + x;
	} 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 <= (-9.6d+32)) then
        tmp = t_0
    else if (z <= 6d-294) then
        tmp = z + x
    else if (z <= 2.2d-210) then
        tmp = z + (y + x)
    else if (z <= 7d+127) then
        tmp = z + x
    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 <= -9.6e+32) {
		tmp = t_0;
	} else if (z <= 6e-294) {
		tmp = z + x;
	} else if (z <= 2.2e-210) {
		tmp = z + (y + x);
	} else if (z <= 7e+127) {
		tmp = z + x;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = z * math.cos(y)
	tmp = 0
	if z <= -9.6e+32:
		tmp = t_0
	elif z <= 6e-294:
		tmp = z + x
	elif z <= 2.2e-210:
		tmp = z + (y + x)
	elif z <= 7e+127:
		tmp = z + x
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(z * cos(y))
	tmp = 0.0
	if (z <= -9.6e+32)
		tmp = t_0;
	elseif (z <= 6e-294)
		tmp = Float64(z + x);
	elseif (z <= 2.2e-210)
		tmp = Float64(z + Float64(y + x));
	elseif (z <= 7e+127)
		tmp = Float64(z + x);
	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 <= -9.6e+32)
		tmp = t_0;
	elseif (z <= 6e-294)
		tmp = z + x;
	elseif (z <= 2.2e-210)
		tmp = z + (y + x);
	elseif (z <= 7e+127)
		tmp = z + x;
	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, -9.6e+32], t$95$0, If[LessEqual[z, 6e-294], N[(z + x), $MachinePrecision], If[LessEqual[z, 2.2e-210], N[(z + N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7e+127], N[(z + x), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -9.6 \cdot 10^{+32}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq 6 \cdot 10^{-294}:\\
\;\;\;\;z + x\\

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

\mathbf{elif}\;z \leq 7 \cdot 10^{+127}:\\
\;\;\;\;z + x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -9.59999999999999965e32 or 6.99999999999999956e127 < z

    1. Initial program 99.8%

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

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

    if -9.59999999999999965e32 < z < 5.9999999999999998e-294 or 2.19999999999999989e-210 < z < 6.99999999999999956e127

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{x + z} \]
    4. Step-by-step derivation
      1. +-commutative69.9%

        \[\leadsto \color{blue}{z + x} \]
    5. Simplified69.9%

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

    if 5.9999999999999998e-294 < z < 2.19999999999999989e-210

    1. Initial program 100.0%

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

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

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

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

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

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

Alternative 5: 84.2% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -3.6 \cdot 10^{+32}:\\
\;\;\;\;t\_0\\

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

\mathbf{elif}\;z \leq 1.75 \cdot 10^{+139}:\\
\;\;\;\;z + x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -3.5999999999999997e32 or 1.74999999999999989e139 < z

    1. Initial program 99.8%

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

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

    if -3.5999999999999997e32 < z < 2.25e-39

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{x + \sin y} \]
    4. Step-by-step derivation
      1. +-commutative90.6%

        \[\leadsto \color{blue}{\sin y + x} \]
    5. Simplified90.6%

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

    if 2.25e-39 < z < 1.74999999999999989e139

    1. Initial program 99.9%

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

      \[\leadsto \color{blue}{x + z} \]
    4. Step-by-step derivation
      1. +-commutative83.7%

        \[\leadsto \color{blue}{z + x} \]
    5. Simplified83.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.6 \cdot 10^{+32}:\\ \;\;\;\;z \cdot \cos y\\ \mathbf{elif}\;z \leq 2.25 \cdot 10^{-39}:\\ \;\;\;\;x + \sin y\\ \mathbf{elif}\;z \leq 1.75 \cdot 10^{+139}:\\ \;\;\;\;z + x\\ \mathbf{else}:\\ \;\;\;\;z \cdot \cos y\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 98.8% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -3.6 \cdot 10^{+32} \lor \neg \left(z \leq 7.8 \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 -3.6e+32) (not (<= z 7.8e-5)))
   (+ x (* z (cos y)))
   (+ z (+ x (sin y)))))
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -3.6e+32) || !(z <= 7.8e-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 <= (-3.6d+32)) .or. (.not. (z <= 7.8d-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 <= -3.6e+32) || !(z <= 7.8e-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 <= -3.6e+32) or not (z <= 7.8e-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 <= -3.6e+32) || !(z <= 7.8e-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 <= -3.6e+32) || ~((z <= 7.8e-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, -3.6e+32], N[Not[LessEqual[z, 7.8e-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 -3.6 \cdot 10^{+32} \lor \neg \left(z \leq 7.8 \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 < -3.5999999999999997e32 or 7.7999999999999999e-5 < z

    1. Initial program 99.8%

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

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

    if -3.5999999999999997e32 < z < 7.7999999999999999e-5

    1. Initial program 100.0%

      \[\left(x + \sin y\right) + z \cdot \cos y \]
    2. Add Preprocessing
    3. 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.5%

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

Alternative 7: 95.3% accurate, 1.8× speedup?

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

    1. Initial program 99.8%

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

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

    if -3.40000000000000001e-18 < z < 1.25e-39

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{x + \sin y} \]
    4. Step-by-step derivation
      1. +-commutative93.2%

        \[\leadsto \color{blue}{\sin y + x} \]
    5. Simplified93.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.4 \cdot 10^{-18} \lor \neg \left(z \leq 1.25 \cdot 10^{-39}\right):\\ \;\;\;\;x + z \cdot \cos y\\ \mathbf{else}:\\ \;\;\;\;x + \sin y\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 71.2% accurate, 9.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.49999999999999997e24 or 4.79999999999999982 < y

    1. Initial program 99.8%

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

      \[\leadsto \color{blue}{x + z} \]
    4. Step-by-step derivation
      1. +-commutative38.9%

        \[\leadsto \color{blue}{z + x} \]
    5. Simplified38.9%

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

    if -1.49999999999999997e24 < y < 4.79999999999999982

    1. Initial program 100.0%

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

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

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

        \[\leadsto \color{blue}{\left(z + x\right)} + y \cdot \left(1 + -0.5 \cdot \left(y \cdot z\right)\right) \]
      3. associate-*r*95.4%

        \[\leadsto \left(z + x\right) + y \cdot \left(1 + \color{blue}{\left(-0.5 \cdot y\right) \cdot z}\right) \]
    5. Simplified95.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.5 \cdot 10^{+24} \lor \neg \left(y \leq 4.8\right):\\ \;\;\;\;z + x\\ \mathbf{else}:\\ \;\;\;\;\left(z + x\right) + y \cdot \left(1 + z \cdot \left(y \cdot -0.5\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 71.1% accurate, 13.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.5 \cdot 10^{+48} \lor \neg \left(y \leq 1.35 \cdot 10^{+43}\right):\\
\;\;\;\;z + x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -7.5000000000000006e48 or 1.3500000000000001e43 < y

    1. Initial program 99.8%

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

      \[\leadsto \color{blue}{x + z} \]
    4. Step-by-step derivation
      1. +-commutative38.0%

        \[\leadsto \color{blue}{z + x} \]
    5. Simplified38.0%

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

    if -7.5000000000000006e48 < y < 1.3500000000000001e43

    1. Initial program 100.0%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -7.5 \cdot 10^{+48} \lor \neg \left(y \leq 1.35 \cdot 10^{+43}\right):\\ \;\;\;\;z + x\\ \mathbf{else}:\\ \;\;\;\;z + \left(y + x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 59.1% accurate, 15.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.65 \cdot 10^{+32}:\\
\;\;\;\;x\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.6500000000000001e32 or 2.30000000000000009e-17 < x

    1. Initial program 99.9%

      \[\left(x + \sin y\right) + z \cdot \cos y \]
    2. Add Preprocessing
    3. 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-define99.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) \]
    4. 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)} \]
    5. Taylor expanded in x around inf 78.6%

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

    if -1.6500000000000001e32 < x < 2.30000000000000009e-17

    1. Initial program 99.9%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.65 \cdot 10^{+32}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 2.3 \cdot 10^{-17}:\\ \;\;\;\;z + y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 55.3% accurate, 18.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.3 \cdot 10^{+33}:\\
\;\;\;\;x\\

\mathbf{elif}\;x \leq 1.22 \cdot 10^{-16}:\\
\;\;\;\;z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -4.30000000000000028e33 or 1.22e-16 < x

    1. Initial program 99.9%

      \[\left(x + \sin y\right) + z \cdot \cos y \]
    2. Add Preprocessing
    3. 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-define99.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) \]
    4. 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)} \]
    5. Taylor expanded in x around inf 79.2%

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

    if -4.30000000000000028e33 < x < 1.22e-16

    1. Initial program 99.8%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{z \cdot \cos y} \]
    6. Step-by-step derivation
      1. *-commutative62.1%

        \[\leadsto \color{blue}{\cos y \cdot z} \]
    7. Simplified62.1%

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

      \[\leadsto \color{blue}{z} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 12: 66.6% accurate, 69.0× speedup?

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

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

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

    \[\leadsto \color{blue}{x + z} \]
  4. Step-by-step derivation
    1. +-commutative63.5%

      \[\leadsto \color{blue}{z + x} \]
  5. Simplified63.5%

    \[\leadsto \color{blue}{z + x} \]
  6. Add Preprocessing

Alternative 13: 42.2% 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. Add Preprocessing
  3. Step-by-step derivation
    1. +-commutative99.9%

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

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

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

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

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

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

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

Reproduce

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