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

Percentage Accurate: 99.9% → 99.9%
Time: 9.7s
Alternatives: 16
Speedup: 1.0×

Specification

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

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

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

Alternative 1: 99.9% accurate, 0.7× speedup?

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

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

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

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

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

      \[\leadsto \color{blue}{\cos y + \left(x + \left(-z\right) \cdot \sin y\right)} \]
    4. +-commutative99.9%

      \[\leadsto \cos y + \color{blue}{\left(\left(-z\right) \cdot \sin y + x\right)} \]
    5. distribute-lft-neg-out99.9%

      \[\leadsto \cos y + \left(\color{blue}{\left(-z \cdot \sin y\right)} + x\right) \]
    6. distribute-rgt-neg-in99.9%

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

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

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

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

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

Alternative 2: 98.5% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -108000000:\\
\;\;\;\;x \cdot \left(1 + z \cdot \frac{\frac{1}{z} - \sin y}{x}\right)\\

\mathbf{elif}\;x \leq 3 \cdot 10^{-35}:\\
\;\;\;\;\cos y - z \cdot \sin y\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, -\sin y, x\right) + 1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.08e8

    1. Initial program 99.9%

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

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

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

        \[\leadsto \color{blue}{\cos y + \left(x + \left(-z\right) \cdot \sin y\right)} \]
      4. +-commutative99.9%

        \[\leadsto \cos y + \color{blue}{\left(\left(-z\right) \cdot \sin y + x\right)} \]
      5. distribute-lft-neg-out99.9%

        \[\leadsto \cos y + \left(\color{blue}{\left(-z \cdot \sin y\right)} + x\right) \]
      6. distribute-rgt-neg-in99.9%

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(z \cdot \left(\sin y + -1 \cdot \frac{x + \cos y}{z}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg81.3%

        \[\leadsto \color{blue}{-z \cdot \left(\sin y + -1 \cdot \frac{x + \cos y}{z}\right)} \]
      2. distribute-rgt-neg-in81.3%

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

        \[\leadsto z \cdot \left(-\color{blue}{\left(-1 \cdot \frac{x + \cos y}{z} + \sin y\right)}\right) \]
      4. *-lft-identity81.3%

        \[\leadsto z \cdot \left(-\left(-1 \cdot \frac{x + \cos y}{z} + \color{blue}{1 \cdot \sin y}\right)\right) \]
      5. metadata-eval81.3%

        \[\leadsto z \cdot \left(-\left(-1 \cdot \frac{x + \cos y}{z} + \color{blue}{\left(--1\right)} \cdot \sin y\right)\right) \]
      6. cancel-sign-sub-inv81.3%

        \[\leadsto z \cdot \left(-\color{blue}{\left(-1 \cdot \frac{x + \cos y}{z} - -1 \cdot \sin y\right)}\right) \]
      7. distribute-lft-out--81.3%

        \[\leadsto z \cdot \left(-\color{blue}{-1 \cdot \left(\frac{x + \cos y}{z} - \sin y\right)}\right) \]
      8. mul-1-neg81.3%

        \[\leadsto z \cdot \left(-\color{blue}{\left(-\left(\frac{x + \cos y}{z} - \sin y\right)\right)}\right) \]
      9. remove-double-neg81.3%

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

      \[\leadsto \color{blue}{z \cdot \left(\frac{x + \cos y}{z} - \sin y\right)} \]
    8. Taylor expanded in y around 0 81.3%

      \[\leadsto z \cdot \left(\color{blue}{\frac{1 + x}{z}} - \sin y\right) \]
    9. Step-by-step derivation
      1. +-commutative81.3%

        \[\leadsto z \cdot \left(\frac{\color{blue}{x + 1}}{z} - \sin y\right) \]
    10. Simplified81.3%

      \[\leadsto z \cdot \left(\color{blue}{\frac{x + 1}{z}} - \sin y\right) \]
    11. Taylor expanded in x around inf 99.9%

      \[\leadsto \color{blue}{x \cdot \left(1 + \frac{z \cdot \left(\frac{1}{z} - \sin y\right)}{x}\right)} \]
    12. Step-by-step derivation
      1. associate-/l*99.9%

        \[\leadsto x \cdot \left(1 + \color{blue}{z \cdot \frac{\frac{1}{z} - \sin y}{x}}\right) \]
    13. Simplified99.9%

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

    if -1.08e8 < x < 2.99999999999999989e-35

    1. Initial program 99.8%

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

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

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

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

        \[\leadsto \cos y + \color{blue}{\left(\left(-z\right) \cdot \sin y + x\right)} \]
      5. distribute-lft-neg-out99.8%

        \[\leadsto \cos y + \left(\color{blue}{\left(-z \cdot \sin y\right)} + x\right) \]
      6. distribute-rgt-neg-in99.8%

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

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

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

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

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

      \[\leadsto \color{blue}{\cos y + -1 \cdot \left(z \cdot \sin y\right)} \]
    6. Step-by-step derivation
      1. neg-mul-198.5%

        \[\leadsto \cos y + \color{blue}{\left(-z \cdot \sin y\right)} \]
      2. sub-neg98.5%

        \[\leadsto \color{blue}{\cos y - z \cdot \sin y} \]
    7. Simplified98.5%

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

    if 2.99999999999999989e-35 < x

    1. Initial program 99.9%

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

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

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

        \[\leadsto \color{blue}{\cos y + \left(x + \left(-z\right) \cdot \sin y\right)} \]
      4. +-commutative99.9%

        \[\leadsto \cos y + \color{blue}{\left(\left(-z\right) \cdot \sin y + x\right)} \]
      5. distribute-lft-neg-out99.9%

        \[\leadsto \cos y + \left(\color{blue}{\left(-z \cdot \sin y\right)} + x\right) \]
      6. distribute-rgt-neg-in99.9%

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

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

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

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

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

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

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

Alternative 3: 98.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \sin y\\ \mathbf{if}\;x \leq -108000000:\\ \;\;\;\;x \cdot \left(1 + z \cdot \frac{\frac{1}{z} - \sin y}{x}\right)\\ \mathbf{elif}\;x \leq 3 \cdot 10^{-35}:\\ \;\;\;\;\cos y - t\_0\\ \mathbf{else}:\\ \;\;\;\;\left(x + 1\right) - t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* z (sin y))))
   (if (<= x -108000000.0)
     (* x (+ 1.0 (* z (/ (- (/ 1.0 z) (sin y)) x))))
     (if (<= x 3e-35) (- (cos y) t_0) (- (+ x 1.0) t_0)))))
double code(double x, double y, double z) {
	double t_0 = z * sin(y);
	double tmp;
	if (x <= -108000000.0) {
		tmp = x * (1.0 + (z * (((1.0 / z) - sin(y)) / x)));
	} else if (x <= 3e-35) {
		tmp = cos(y) - t_0;
	} else {
		tmp = (x + 1.0) - 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 * sin(y)
    if (x <= (-108000000.0d0)) then
        tmp = x * (1.0d0 + (z * (((1.0d0 / z) - sin(y)) / x)))
    else if (x <= 3d-35) then
        tmp = cos(y) - t_0
    else
        tmp = (x + 1.0d0) - t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = z * Math.sin(y);
	double tmp;
	if (x <= -108000000.0) {
		tmp = x * (1.0 + (z * (((1.0 / z) - Math.sin(y)) / x)));
	} else if (x <= 3e-35) {
		tmp = Math.cos(y) - t_0;
	} else {
		tmp = (x + 1.0) - t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = z * math.sin(y)
	tmp = 0
	if x <= -108000000.0:
		tmp = x * (1.0 + (z * (((1.0 / z) - math.sin(y)) / x)))
	elif x <= 3e-35:
		tmp = math.cos(y) - t_0
	else:
		tmp = (x + 1.0) - t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(z * sin(y))
	tmp = 0.0
	if (x <= -108000000.0)
		tmp = Float64(x * Float64(1.0 + Float64(z * Float64(Float64(Float64(1.0 / z) - sin(y)) / x))));
	elseif (x <= 3e-35)
		tmp = Float64(cos(y) - t_0);
	else
		tmp = Float64(Float64(x + 1.0) - t_0);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = z * sin(y);
	tmp = 0.0;
	if (x <= -108000000.0)
		tmp = x * (1.0 + (z * (((1.0 / z) - sin(y)) / x)));
	elseif (x <= 3e-35)
		tmp = cos(y) - t_0;
	else
		tmp = (x + 1.0) - t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -108000000.0], N[(x * N[(1.0 + N[(z * N[(N[(N[(1.0 / z), $MachinePrecision] - N[Sin[y], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3e-35], N[(N[Cos[y], $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(x + 1.0), $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := z \cdot \sin y\\
\mathbf{if}\;x \leq -108000000:\\
\;\;\;\;x \cdot \left(1 + z \cdot \frac{\frac{1}{z} - \sin y}{x}\right)\\

\mathbf{elif}\;x \leq 3 \cdot 10^{-35}:\\
\;\;\;\;\cos y - t\_0\\

\mathbf{else}:\\
\;\;\;\;\left(x + 1\right) - t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.08e8

    1. Initial program 99.9%

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

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

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

        \[\leadsto \color{blue}{\cos y + \left(x + \left(-z\right) \cdot \sin y\right)} \]
      4. +-commutative99.9%

        \[\leadsto \cos y + \color{blue}{\left(\left(-z\right) \cdot \sin y + x\right)} \]
      5. distribute-lft-neg-out99.9%

        \[\leadsto \cos y + \left(\color{blue}{\left(-z \cdot \sin y\right)} + x\right) \]
      6. distribute-rgt-neg-in99.9%

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(z \cdot \left(\sin y + -1 \cdot \frac{x + \cos y}{z}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg81.3%

        \[\leadsto \color{blue}{-z \cdot \left(\sin y + -1 \cdot \frac{x + \cos y}{z}\right)} \]
      2. distribute-rgt-neg-in81.3%

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

        \[\leadsto z \cdot \left(-\color{blue}{\left(-1 \cdot \frac{x + \cos y}{z} + \sin y\right)}\right) \]
      4. *-lft-identity81.3%

        \[\leadsto z \cdot \left(-\left(-1 \cdot \frac{x + \cos y}{z} + \color{blue}{1 \cdot \sin y}\right)\right) \]
      5. metadata-eval81.3%

        \[\leadsto z \cdot \left(-\left(-1 \cdot \frac{x + \cos y}{z} + \color{blue}{\left(--1\right)} \cdot \sin y\right)\right) \]
      6. cancel-sign-sub-inv81.3%

        \[\leadsto z \cdot \left(-\color{blue}{\left(-1 \cdot \frac{x + \cos y}{z} - -1 \cdot \sin y\right)}\right) \]
      7. distribute-lft-out--81.3%

        \[\leadsto z \cdot \left(-\color{blue}{-1 \cdot \left(\frac{x + \cos y}{z} - \sin y\right)}\right) \]
      8. mul-1-neg81.3%

        \[\leadsto z \cdot \left(-\color{blue}{\left(-\left(\frac{x + \cos y}{z} - \sin y\right)\right)}\right) \]
      9. remove-double-neg81.3%

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

      \[\leadsto \color{blue}{z \cdot \left(\frac{x + \cos y}{z} - \sin y\right)} \]
    8. Taylor expanded in y around 0 81.3%

      \[\leadsto z \cdot \left(\color{blue}{\frac{1 + x}{z}} - \sin y\right) \]
    9. Step-by-step derivation
      1. +-commutative81.3%

        \[\leadsto z \cdot \left(\frac{\color{blue}{x + 1}}{z} - \sin y\right) \]
    10. Simplified81.3%

      \[\leadsto z \cdot \left(\color{blue}{\frac{x + 1}{z}} - \sin y\right) \]
    11. Taylor expanded in x around inf 99.9%

      \[\leadsto \color{blue}{x \cdot \left(1 + \frac{z \cdot \left(\frac{1}{z} - \sin y\right)}{x}\right)} \]
    12. Step-by-step derivation
      1. associate-/l*99.9%

        \[\leadsto x \cdot \left(1 + \color{blue}{z \cdot \frac{\frac{1}{z} - \sin y}{x}}\right) \]
    13. Simplified99.9%

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

    if -1.08e8 < x < 2.99999999999999989e-35

    1. Initial program 99.8%

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

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

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

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

        \[\leadsto \cos y + \color{blue}{\left(\left(-z\right) \cdot \sin y + x\right)} \]
      5. distribute-lft-neg-out99.8%

        \[\leadsto \cos y + \left(\color{blue}{\left(-z \cdot \sin y\right)} + x\right) \]
      6. distribute-rgt-neg-in99.8%

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

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

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

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

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

      \[\leadsto \color{blue}{\cos y + -1 \cdot \left(z \cdot \sin y\right)} \]
    6. Step-by-step derivation
      1. neg-mul-198.5%

        \[\leadsto \cos y + \color{blue}{\left(-z \cdot \sin y\right)} \]
      2. sub-neg98.5%

        \[\leadsto \color{blue}{\cos y - z \cdot \sin y} \]
    7. Simplified98.5%

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

    if 2.99999999999999989e-35 < x

    1. Initial program 99.9%

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

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

Alternative 4: 99.9% accurate, 1.0× speedup?

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

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

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

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

Alternative 5: 99.4% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.5 \lor \neg \left(z \leq 0.023\right):\\
\;\;\;\;\left(x + 1\right) - z \cdot \sin y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.5 or 0.023 < z

    1. Initial program 99.7%

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

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

    if -1.5 < z < 0.023

    1. Initial program 100.0%

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

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

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

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

        \[\leadsto \cos y + \color{blue}{\left(\left(-z\right) \cdot \sin y + x\right)} \]
      5. distribute-lft-neg-out100.0%

        \[\leadsto \cos y + \left(\color{blue}{\left(-z \cdot \sin y\right)} + x\right) \]
      6. distribute-rgt-neg-in100.0%

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

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

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

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

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

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

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

Alternative 6: 99.4% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -0.75:\\ \;\;\;\;z \cdot \left(\frac{x + 1}{z} - \sin y\right)\\ \mathbf{elif}\;z \leq 0.011:\\ \;\;\;\;\cos y + x\\ \mathbf{else}:\\ \;\;\;\;\left(x + 1\right) - z \cdot \sin y\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= z -0.75)
   (* z (- (/ (+ x 1.0) z) (sin y)))
   (if (<= z 0.011) (+ (cos y) x) (- (+ x 1.0) (* z (sin y))))))
double code(double x, double y, double z) {
	double tmp;
	if (z <= -0.75) {
		tmp = z * (((x + 1.0) / z) - sin(y));
	} else if (z <= 0.011) {
		tmp = cos(y) + x;
	} else {
		tmp = (x + 1.0) - (z * 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 <= (-0.75d0)) then
        tmp = z * (((x + 1.0d0) / z) - sin(y))
    else if (z <= 0.011d0) then
        tmp = cos(y) + x
    else
        tmp = (x + 1.0d0) - (z * sin(y))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -0.75) {
		tmp = z * (((x + 1.0) / z) - Math.sin(y));
	} else if (z <= 0.011) {
		tmp = Math.cos(y) + x;
	} else {
		tmp = (x + 1.0) - (z * Math.sin(y));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if z <= -0.75:
		tmp = z * (((x + 1.0) / z) - math.sin(y))
	elif z <= 0.011:
		tmp = math.cos(y) + x
	else:
		tmp = (x + 1.0) - (z * math.sin(y))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (z <= -0.75)
		tmp = Float64(z * Float64(Float64(Float64(x + 1.0) / z) - sin(y)));
	elseif (z <= 0.011)
		tmp = Float64(cos(y) + x);
	else
		tmp = Float64(Float64(x + 1.0) - Float64(z * sin(y)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -0.75)
		tmp = z * (((x + 1.0) / z) - sin(y));
	elseif (z <= 0.011)
		tmp = cos(y) + x;
	else
		tmp = (x + 1.0) - (z * sin(y));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[z, -0.75], N[(z * N[(N[(N[(x + 1.0), $MachinePrecision] / z), $MachinePrecision] - N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.011], N[(N[Cos[y], $MachinePrecision] + x), $MachinePrecision], N[(N[(x + 1.0), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.75:\\
\;\;\;\;z \cdot \left(\frac{x + 1}{z} - \sin y\right)\\

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

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


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

    1. Initial program 99.7%

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

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

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

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

        \[\leadsto \cos y + \color{blue}{\left(\left(-z\right) \cdot \sin y + x\right)} \]
      5. distribute-lft-neg-out99.7%

        \[\leadsto \cos y + \left(\color{blue}{\left(-z \cdot \sin y\right)} + x\right) \]
      6. distribute-rgt-neg-in99.7%

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(z \cdot \left(\sin y + -1 \cdot \frac{x + \cos y}{z}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg99.7%

        \[\leadsto \color{blue}{-z \cdot \left(\sin y + -1 \cdot \frac{x + \cos y}{z}\right)} \]
      2. distribute-rgt-neg-in99.7%

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

        \[\leadsto z \cdot \left(-\color{blue}{\left(-1 \cdot \frac{x + \cos y}{z} + \sin y\right)}\right) \]
      4. *-lft-identity99.7%

        \[\leadsto z \cdot \left(-\left(-1 \cdot \frac{x + \cos y}{z} + \color{blue}{1 \cdot \sin y}\right)\right) \]
      5. metadata-eval99.7%

        \[\leadsto z \cdot \left(-\left(-1 \cdot \frac{x + \cos y}{z} + \color{blue}{\left(--1\right)} \cdot \sin y\right)\right) \]
      6. cancel-sign-sub-inv99.7%

        \[\leadsto z \cdot \left(-\color{blue}{\left(-1 \cdot \frac{x + \cos y}{z} - -1 \cdot \sin y\right)}\right) \]
      7. distribute-lft-out--99.7%

        \[\leadsto z \cdot \left(-\color{blue}{-1 \cdot \left(\frac{x + \cos y}{z} - \sin y\right)}\right) \]
      8. mul-1-neg99.7%

        \[\leadsto z \cdot \left(-\color{blue}{\left(-\left(\frac{x + \cos y}{z} - \sin y\right)\right)}\right) \]
      9. remove-double-neg99.7%

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

      \[\leadsto \color{blue}{z \cdot \left(\frac{x + \cos y}{z} - \sin y\right)} \]
    8. Taylor expanded in y around 0 99.3%

      \[\leadsto z \cdot \left(\color{blue}{\frac{1 + x}{z}} - \sin y\right) \]
    9. Step-by-step derivation
      1. +-commutative99.3%

        \[\leadsto z \cdot \left(\frac{\color{blue}{x + 1}}{z} - \sin y\right) \]
    10. Simplified99.3%

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

    if -0.75 < z < 0.010999999999999999

    1. Initial program 100.0%

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

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

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

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

        \[\leadsto \cos y + \color{blue}{\left(\left(-z\right) \cdot \sin y + x\right)} \]
      5. distribute-lft-neg-out100.0%

        \[\leadsto \cos y + \left(\color{blue}{\left(-z \cdot \sin y\right)} + x\right) \]
      6. distribute-rgt-neg-in100.0%

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

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

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

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

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

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

    if 0.010999999999999999 < z

    1. Initial program 99.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.75:\\ \;\;\;\;z \cdot \left(\frac{x + 1}{z} - \sin y\right)\\ \mathbf{elif}\;z \leq 0.011:\\ \;\;\;\;\cos y + x\\ \mathbf{else}:\\ \;\;\;\;\left(x + 1\right) - z \cdot \sin y\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 93.3% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -19000000000 \lor \neg \left(z \leq 2.9 \cdot 10^{+72}\right):\\
\;\;\;\;x - z \cdot \sin y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.9e10 or 2.90000000000000017e72 < z

    1. Initial program 99.7%

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

        \[\leadsto \left(x + \color{blue}{\log \left(e^{\cos y}\right)}\right) - z \cdot \sin y \]
    4. Applied egg-rr99.7%

      \[\leadsto \left(x + \color{blue}{\log \left(e^{\cos y}\right)}\right) - z \cdot \sin y \]
    5. Step-by-step derivation
      1. add-log-exp99.7%

        \[\leadsto \left(x + \log \color{blue}{\log \left(e^{e^{\cos y}}\right)}\right) - z \cdot \sin y \]
    6. Applied egg-rr99.7%

      \[\leadsto \left(x + \log \color{blue}{\log \left(e^{e^{\cos y}}\right)}\right) - z \cdot \sin y \]
    7. Taylor expanded in x around inf 93.3%

      \[\leadsto \color{blue}{x} - z \cdot \sin y \]

    if -1.9e10 < z < 2.90000000000000017e72

    1. Initial program 100.0%

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

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

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

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

        \[\leadsto \cos y + \color{blue}{\left(\left(-z\right) \cdot \sin y + x\right)} \]
      5. distribute-lft-neg-out100.0%

        \[\leadsto \cos y + \left(\color{blue}{\left(-z \cdot \sin y\right)} + x\right) \]
      6. distribute-rgt-neg-in100.0%

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

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

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

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

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

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

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

Alternative 8: 81.8% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.2 \cdot 10^{+77} \lor \neg \left(z \leq 2.75 \cdot 10^{+191}\right):\\
\;\;\;\;z \cdot \left(-\sin y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -4.1999999999999997e77 or 2.7500000000000001e191 < z

    1. Initial program 99.8%

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

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

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

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

        \[\leadsto \cos y + \color{blue}{\left(\left(-z\right) \cdot \sin y + x\right)} \]
      5. distribute-lft-neg-out99.8%

        \[\leadsto \cos y + \left(\color{blue}{\left(-z \cdot \sin y\right)} + x\right) \]
      6. distribute-rgt-neg-in99.8%

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

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

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

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

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

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

        \[\leadsto \color{blue}{-z \cdot \sin y} \]
      2. distribute-rgt-neg-in72.3%

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

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

    if -4.1999999999999997e77 < z < 2.7500000000000001e191

    1. Initial program 99.9%

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

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

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

        \[\leadsto \color{blue}{\cos y + \left(x + \left(-z\right) \cdot \sin y\right)} \]
      4. +-commutative99.9%

        \[\leadsto \cos y + \color{blue}{\left(\left(-z\right) \cdot \sin y + x\right)} \]
      5. distribute-lft-neg-out99.9%

        \[\leadsto \cos y + \left(\color{blue}{\left(-z \cdot \sin y\right)} + x\right) \]
      6. distribute-rgt-neg-in99.9%

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

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

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

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

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

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

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

Alternative 9: 81.8% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3100000000 \lor \neg \left(y \leq 9 \cdot 10^{-6}\right):\\
\;\;\;\;\cos y + x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.1e9 or 9.00000000000000023e-6 < y

    1. Initial program 99.8%

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

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

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

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

        \[\leadsto \cos y + \color{blue}{\left(\left(-z\right) \cdot \sin y + x\right)} \]
      5. distribute-lft-neg-out99.8%

        \[\leadsto \cos y + \left(\color{blue}{\left(-z \cdot \sin y\right)} + x\right) \]
      6. distribute-rgt-neg-in99.8%

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

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

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

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

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

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

    if -3.1e9 < y < 9.00000000000000023e-6

    1. Initial program 99.9%

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

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

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

Alternative 10: 72.4% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.062 \lor \neg \left(x \leq 3 \cdot 10^{-35}\right):\\
\;\;\;\;x + 1\\

\mathbf{else}:\\
\;\;\;\;\cos y\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -0.062 or 2.99999999999999989e-35 < x

    1. Initial program 99.9%

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

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

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

        \[\leadsto \color{blue}{\cos y + \left(x + \left(-z\right) \cdot \sin y\right)} \]
      4. +-commutative99.9%

        \[\leadsto \cos y + \color{blue}{\left(\left(-z\right) \cdot \sin y + x\right)} \]
      5. distribute-lft-neg-out99.9%

        \[\leadsto \cos y + \left(\color{blue}{\left(-z \cdot \sin y\right)} + x\right) \]
      6. distribute-rgt-neg-in99.9%

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

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

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

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

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

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

    if -0.062 < x < 2.99999999999999989e-35

    1. Initial program 99.8%

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

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

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

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

        \[\leadsto \cos y + \color{blue}{\left(\left(-z\right) \cdot \sin y + x\right)} \]
      5. distribute-lft-neg-out99.8%

        \[\leadsto \cos y + \left(\color{blue}{\left(-z \cdot \sin y\right)} + x\right) \]
      6. distribute-rgt-neg-in99.8%

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

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

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

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

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

      \[\leadsto \color{blue}{x + \cos y} \]
    6. Taylor expanded in x around 0 62.5%

      \[\leadsto \color{blue}{\cos y} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification73.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -0.062 \lor \neg \left(x \leq 3 \cdot 10^{-35}\right):\\ \;\;\;\;x + 1\\ \mathbf{else}:\\ \;\;\;\;\cos y\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 71.4% accurate, 7.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.5 \cdot 10^{+27} \lor \neg \left(y \leq 720\right):\\
\;\;\;\;x + 1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.5000000000000002e27 or 720 < y

    1. Initial program 99.8%

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

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

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

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

        \[\leadsto \cos y + \color{blue}{\left(\left(-z\right) \cdot \sin y + x\right)} \]
      5. distribute-lft-neg-out99.8%

        \[\leadsto \cos y + \left(\color{blue}{\left(-z \cdot \sin y\right)} + x\right) \]
      6. distribute-rgt-neg-in99.8%

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

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

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

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

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

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

    if -3.5000000000000002e27 < y < 720

    1. Initial program 99.9%

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

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

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

Alternative 12: 71.2% accurate, 9.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.45 \cdot 10^{+46} \lor \neg \left(y \leq 840\right):\\
\;\;\;\;x + 1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.4500000000000001e46 or 840 < y

    1. Initial program 99.8%

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

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

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

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

        \[\leadsto \cos y + \color{blue}{\left(\left(-z\right) \cdot \sin y + x\right)} \]
      5. distribute-lft-neg-out99.8%

        \[\leadsto \cos y + \left(\color{blue}{\left(-z \cdot \sin y\right)} + x\right) \]
      6. distribute-rgt-neg-in99.8%

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

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

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

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

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

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

    if -1.4500000000000001e46 < y < 840

    1. Initial program 99.9%

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

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

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

Alternative 13: 71.1% accurate, 12.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -7 \cdot 10^{+86} \lor \neg \left(y \leq 38000000\right):\\
\;\;\;\;x + 1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -7.00000000000000038e86 or 3.8e7 < y

    1. Initial program 99.8%

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

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

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

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

        \[\leadsto \cos y + \color{blue}{\left(\left(-z\right) \cdot \sin y + x\right)} \]
      5. distribute-lft-neg-out99.8%

        \[\leadsto \cos y + \left(\color{blue}{\left(-z \cdot \sin y\right)} + x\right) \]
      6. distribute-rgt-neg-in99.8%

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

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

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

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

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

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

    if -7.00000000000000038e86 < y < 3.8e7

    1. Initial program 99.9%

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

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

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

        \[\leadsto \color{blue}{\cos y + \left(x + \left(-z\right) \cdot \sin y\right)} \]
      4. +-commutative99.9%

        \[\leadsto \cos y + \color{blue}{\left(\left(-z\right) \cdot \sin y + x\right)} \]
      5. distribute-lft-neg-out99.9%

        \[\leadsto \cos y + \left(\color{blue}{\left(-z \cdot \sin y\right)} + x\right) \]
      6. distribute-rgt-neg-in99.9%

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

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

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

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

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

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

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

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

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

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

Alternative 14: 63.6% accurate, 23.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.6 \cdot 10^{+265}:\\
\;\;\;\;x + 1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 1.60000000000000007e265

    1. Initial program 99.9%

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

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

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

        \[\leadsto \color{blue}{\cos y + \left(x + \left(-z\right) \cdot \sin y\right)} \]
      4. +-commutative99.9%

        \[\leadsto \cos y + \color{blue}{\left(\left(-z\right) \cdot \sin y + x\right)} \]
      5. distribute-lft-neg-out99.9%

        \[\leadsto \cos y + \left(\color{blue}{\left(-z \cdot \sin y\right)} + x\right) \]
      6. distribute-rgt-neg-in99.9%

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

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

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

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

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

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

    if 1.60000000000000007e265 < z

    1. Initial program 100.0%

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

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

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

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

        \[\leadsto \cos y + \color{blue}{\left(\left(-z\right) \cdot \sin y + x\right)} \]
      5. distribute-lft-neg-out100.0%

        \[\leadsto \cos y + \left(\color{blue}{\left(-z \cdot \sin y\right)} + x\right) \]
      6. distribute-rgt-neg-in100.0%

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(z \cdot \left(\sin y + -1 \cdot \frac{x + \cos y}{z}\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg100.0%

        \[\leadsto \color{blue}{-z \cdot \left(\sin y + -1 \cdot \frac{x + \cos y}{z}\right)} \]
      2. distribute-rgt-neg-in100.0%

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

        \[\leadsto z \cdot \left(-\color{blue}{\left(-1 \cdot \frac{x + \cos y}{z} + \sin y\right)}\right) \]
      4. *-lft-identity100.0%

        \[\leadsto z \cdot \left(-\left(-1 \cdot \frac{x + \cos y}{z} + \color{blue}{1 \cdot \sin y}\right)\right) \]
      5. metadata-eval100.0%

        \[\leadsto z \cdot \left(-\left(-1 \cdot \frac{x + \cos y}{z} + \color{blue}{\left(--1\right)} \cdot \sin y\right)\right) \]
      6. cancel-sign-sub-inv100.0%

        \[\leadsto z \cdot \left(-\color{blue}{\left(-1 \cdot \frac{x + \cos y}{z} - -1 \cdot \sin y\right)}\right) \]
      7. distribute-lft-out--100.0%

        \[\leadsto z \cdot \left(-\color{blue}{-1 \cdot \left(\frac{x + \cos y}{z} - \sin y\right)}\right) \]
      8. mul-1-neg100.0%

        \[\leadsto z \cdot \left(-\color{blue}{\left(-\left(\frac{x + \cos y}{z} - \sin y\right)\right)}\right) \]
      9. remove-double-neg100.0%

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

      \[\leadsto \color{blue}{z \cdot \left(\frac{x + \cos y}{z} - \sin y\right)} \]
    8. Taylor expanded in y around 0 88.9%

      \[\leadsto z \cdot \color{blue}{\left(y \cdot \left(-0.5 \cdot \frac{y}{z} - 1\right) + \left(\frac{1}{z} + \frac{x}{z}\right)\right)} \]
    9. Taylor expanded in z around inf 78.2%

      \[\leadsto z \cdot \color{blue}{\left(-1 \cdot y\right)} \]
    10. Step-by-step derivation
      1. mul-1-neg78.2%

        \[\leadsto z \cdot \color{blue}{\left(-y\right)} \]
    11. Simplified78.2%

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

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

Alternative 15: 62.8% accurate, 69.0× speedup?

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

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

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

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

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

      \[\leadsto \color{blue}{\cos y + \left(x + \left(-z\right) \cdot \sin y\right)} \]
    4. +-commutative99.9%

      \[\leadsto \cos y + \color{blue}{\left(\left(-z\right) \cdot \sin y + x\right)} \]
    5. distribute-lft-neg-out99.9%

      \[\leadsto \cos y + \left(\color{blue}{\left(-z \cdot \sin y\right)} + x\right) \]
    6. distribute-rgt-neg-in99.9%

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

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

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

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

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

    \[\leadsto \color{blue}{1 + x} \]
  6. Final simplification63.2%

    \[\leadsto x + 1 \]
  7. Add Preprocessing

Alternative 16: 43.6% 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 + \cos y\right) - z \cdot \sin y \]
  2. Step-by-step derivation
    1. cancel-sign-sub-inv99.9%

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

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

      \[\leadsto \color{blue}{\cos y + \left(x + \left(-z\right) \cdot \sin y\right)} \]
    4. +-commutative99.9%

      \[\leadsto \cos y + \color{blue}{\left(\left(-z\right) \cdot \sin y + x\right)} \]
    5. distribute-lft-neg-out99.9%

      \[\leadsto \cos y + \left(\color{blue}{\left(-z \cdot \sin y\right)} + x\right) \]
    6. distribute-rgt-neg-in99.9%

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

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

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

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

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

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

Reproduce

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