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

Percentage Accurate: 99.9% → 99.9%
Time: 11.3s
Alternatives: 12
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 12 alternatives:

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.9% accurate, 1.0× speedup?

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

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

Alternative 3: 96.4% accurate, 1.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{+69} \lor \neg \left(z \leq 5.5 \cdot 10^{+54}\right):\\
\;\;\;\;z \cdot \left(x \cdot \left(\left(\frac{1}{z} + \frac{\frac{1}{z}}{x}\right) - \frac{\sin y}{x}\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.80000000000000028e69 or 5.50000000000000026e54 < z

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.80000000000000028e69 < z < 5.50000000000000026e54

    1. Initial program 100.0%

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

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

        \[\leadsto \color{blue}{\cos y + x} \]
    5. Simplified99.7%

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

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

Alternative 4: 92.6% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.7 \cdot 10^{+71} \lor \neg \left(z \leq 8.5 \cdot 10^{+54}\right):\\
\;\;\;\;z \cdot \left(\frac{x}{z} - \sin y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.7e71 or 8.4999999999999995e54 < z

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

    if -3.7e71 < z < 8.4999999999999995e54

    1. Initial program 100.0%

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

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

        \[\leadsto \color{blue}{\cos y + x} \]
    5. Simplified99.7%

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

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

Alternative 5: 82.5% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.1 \cdot 10^{+98} \lor \neg \left(z \leq 3.8 \cdot 10^{+148}\right):\\
\;\;\;\;\sin y \cdot \left(-z\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.10000000000000004e98 or 3.7999999999999998e148 < z

    1. Initial program 99.7%

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

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

        \[\leadsto \color{blue}{\left(-1 \cdot z\right) \cdot \sin y} \]
      2. neg-mul-172.0%

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

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

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

    if -2.10000000000000004e98 < z < 3.7999999999999998e148

    1. Initial program 99.9%

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

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

        \[\leadsto \color{blue}{\cos y + x} \]
    5. Simplified92.2%

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

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

Alternative 6: 77.6% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -8.5 \cdot 10^{+102}:\\ \;\;\;\;x + \left(1 - y \cdot z\right)\\ \mathbf{elif}\;z \leq 3.7 \cdot 10^{+174}:\\ \;\;\;\;\cos y + x\\ \mathbf{else}:\\ \;\;\;\;1 + \left(x + y \cdot \left(y \cdot \left(y \cdot \left(z \cdot 0.16666666666666666\right)\right) - z\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= z -8.5e+102)
   (+ x (- 1.0 (* y z)))
   (if (<= z 3.7e+174)
     (+ (cos y) x)
     (+ 1.0 (+ x (* y (- (* y (* y (* z 0.16666666666666666))) z)))))))
double code(double x, double y, double z) {
	double tmp;
	if (z <= -8.5e+102) {
		tmp = x + (1.0 - (y * z));
	} else if (z <= 3.7e+174) {
		tmp = cos(y) + x;
	} else {
		tmp = 1.0 + (x + (y * ((y * (y * (z * 0.16666666666666666))) - z)));
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (z <= (-8.5d+102)) then
        tmp = x + (1.0d0 - (y * z))
    else if (z <= 3.7d+174) then
        tmp = cos(y) + x
    else
        tmp = 1.0d0 + (x + (y * ((y * (y * (z * 0.16666666666666666d0))) - z)))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -8.5e+102) {
		tmp = x + (1.0 - (y * z));
	} else if (z <= 3.7e+174) {
		tmp = Math.cos(y) + x;
	} else {
		tmp = 1.0 + (x + (y * ((y * (y * (z * 0.16666666666666666))) - z)));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if z <= -8.5e+102:
		tmp = x + (1.0 - (y * z))
	elif z <= 3.7e+174:
		tmp = math.cos(y) + x
	else:
		tmp = 1.0 + (x + (y * ((y * (y * (z * 0.16666666666666666))) - z)))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (z <= -8.5e+102)
		tmp = Float64(x + Float64(1.0 - Float64(y * z)));
	elseif (z <= 3.7e+174)
		tmp = Float64(cos(y) + x);
	else
		tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * Float64(y * Float64(z * 0.16666666666666666))) - z))));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -8.5e+102)
		tmp = x + (1.0 - (y * z));
	elseif (z <= 3.7e+174)
		tmp = cos(y) + x;
	else
		tmp = 1.0 + (x + (y * ((y * (y * (z * 0.16666666666666666))) - z)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[z, -8.5e+102], N[(x + N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.7e+174], N[(N[Cos[y], $MachinePrecision] + x), $MachinePrecision], N[(1.0 + N[(x + N[(y * N[(N[(y * N[(y * N[(z * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.5 \cdot 10^{+102}:\\
\;\;\;\;x + \left(1 - y \cdot z\right)\\

\mathbf{elif}\;z \leq 3.7 \cdot 10^{+174}:\\
\;\;\;\;\cos y + x\\

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


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

    1. Initial program 99.7%

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

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

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

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

        \[\leadsto \color{blue}{x + \left(1 + -1 \cdot \left(y \cdot z\right)\right)} \]
      4. mul-1-neg54.6%

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

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

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

    if -8.4999999999999996e102 < z < 3.7000000000000002e174

    1. Initial program 99.9%

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

      \[\leadsto \color{blue}{x + \cos y} \]
    4. Step-by-step derivation
      1. +-commutative88.8%

        \[\leadsto \color{blue}{\cos y + x} \]
    5. Simplified88.8%

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

    if 3.7000000000000002e174 < 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 59.2%

      \[\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)} \]
    4. Taylor expanded in y around inf 59.2%

      \[\leadsto 1 + \left(x + y \cdot \left(y \cdot \color{blue}{\left(0.16666666666666666 \cdot \left(y \cdot z\right)\right)} - z\right)\right) \]
    5. Step-by-step derivation
      1. *-commutative59.2%

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

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

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

Alternative 7: 69.5% accurate, 8.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -7200 \lor \neg \left(y \leq 19000000000000\right):\\
\;\;\;\;x + 1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -7200 or 1.9e13 < y

    1. Initial program 99.8%

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

      \[\leadsto \color{blue}{1 + x} \]
    4. Step-by-step derivation
      1. +-commutative45.3%

        \[\leadsto \color{blue}{x + 1} \]
    5. Simplified45.3%

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

    if -7200 < y < 1.9e13

    1. Initial program 100.0%

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

      \[\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)} \]
    4. Taylor expanded in y around inf 96.7%

      \[\leadsto 1 + \left(x + y \cdot \left(y \cdot \color{blue}{\left(0.16666666666666666 \cdot \left(y \cdot z\right)\right)} - z\right)\right) \]
    5. Step-by-step derivation
      1. *-commutative96.7%

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

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

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

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

Alternative 8: 69.4% accurate, 12.1× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.2e22 or 5.5e11 < y

    1. Initial program 99.7%

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

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

        \[\leadsto \color{blue}{x + 1} \]
    5. Simplified43.6%

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

    if -3.2e22 < y < 5.5e11

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

Alternative 9: 66.7% accurate, 13.8× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;1 - y \cdot z\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.3000000000000001e-8 or 9.00000000000000023e-6 < 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 83.4%

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

        \[\leadsto \color{blue}{x + 1} \]
    5. Simplified83.4%

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

    if -2.3000000000000001e-8 < x < 9.00000000000000023e-6

    1. Initial program 99.8%

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

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

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

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

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

      \[\leadsto x \cdot \left(1 + \color{blue}{\left(-1 \cdot \frac{y \cdot z}{x} + \frac{1}{x}\right)}\right) \]
    7. Taylor expanded in x around 0 55.2%

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

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

        \[\leadsto 1 + \color{blue}{\left(-1 \cdot z\right) \cdot y} \]
      3. mul-1-neg55.2%

        \[\leadsto 1 + \color{blue}{\left(-z\right)} \cdot y \]
    9. Simplified55.2%

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

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

Alternative 10: 61.8% accurate, 23.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.2 \cdot 10^{+207}:\\
\;\;\;\;z \cdot \left(-y\right)\\

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


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

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-1 \cdot z\right) \cdot y} \]
      3. mul-1-neg42.0%

        \[\leadsto \color{blue}{\left(-z\right)} \cdot y \]
    9. Simplified42.0%

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

    if -9.19999999999999979e207 < z

    1. Initial program 99.9%

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

      \[\leadsto \color{blue}{1 + x} \]
    4. Step-by-step derivation
      1. +-commutative67.8%

        \[\leadsto \color{blue}{x + 1} \]
    5. Simplified67.8%

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

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

Alternative 11: 60.9% 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. Add Preprocessing
  3. Taylor expanded in y around 0 62.5%

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

      \[\leadsto \color{blue}{x + 1} \]
  5. Simplified62.5%

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

Alternative 12: 42.7% 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. Add Preprocessing
  3. Taylor expanded in x around inf 42.4%

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

Reproduce

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