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

Percentage Accurate: 99.9% → 99.9%
Time: 9.3s
Alternatives: 15
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 15 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(z, \sin \left(-y\right), x + \cos y\right) \end{array} \]
(FPCore (x y z) :precision binary64 (fma z (sin (- y)) (+ x (cos y))))
double code(double x, double y, double z) {
	return fma(z, sin(-y), (x + cos(y)));
}
function code(x, y, z)
	return fma(z, sin(Float64(-y)), Float64(x + cos(y)))
end
code[x_, y_, z_] := N[(z * N[Sin[(-y)], $MachinePrecision] + N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(z, \sin \left(-y\right), x + \cos y\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(-z\right) \cdot \sin y + \left(x + \cos y\right)} \]
    3. distribute-lft-neg-out99.9%

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

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

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

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

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

Alternative 2: 99.0% accurate, 1.0× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\cos y - z \cdot \sin y\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -9.9999999999999998e-13 or 7.0000000000000003e-17 < x

    1. Initial program 99.9%

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

      \[\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. associate-*r*78.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.9999999999999998e-13 < x < 7.0000000000000003e-17

    1. Initial program 99.9%

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

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

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

Alternative 3: 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}
Derivation
  1. Initial program 99.9%

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

Alternative 4: 84.0% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 - z \cdot \sin y\\ \mathbf{if}\;z \leq -1.8 \cdot 10^{+225}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -7 \cdot 10^{+179}:\\ \;\;\;\;\left(x + 1\right) - z \cdot y\\ \mathbf{elif}\;z \leq -1.15 \cdot 10^{+142} \lor \neg \left(z \leq 1.42 \cdot 10^{+88}\right):\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;x + \cos y\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (- 1.0 (* z (sin y)))))
   (if (<= z -1.8e+225)
     t_0
     (if (<= z -7e+179)
       (- (+ x 1.0) (* z y))
       (if (or (<= z -1.15e+142) (not (<= z 1.42e+88))) t_0 (+ x (cos y)))))))
double code(double x, double y, double z) {
	double t_0 = 1.0 - (z * sin(y));
	double tmp;
	if (z <= -1.8e+225) {
		tmp = t_0;
	} else if (z <= -7e+179) {
		tmp = (x + 1.0) - (z * y);
	} else if ((z <= -1.15e+142) || !(z <= 1.42e+88)) {
		tmp = t_0;
	} else {
		tmp = x + 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) :: t_0
    real(8) :: tmp
    t_0 = 1.0d0 - (z * sin(y))
    if (z <= (-1.8d+225)) then
        tmp = t_0
    else if (z <= (-7d+179)) then
        tmp = (x + 1.0d0) - (z * y)
    else if ((z <= (-1.15d+142)) .or. (.not. (z <= 1.42d+88))) then
        tmp = t_0
    else
        tmp = x + cos(y)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = 1.0 - (z * Math.sin(y));
	double tmp;
	if (z <= -1.8e+225) {
		tmp = t_0;
	} else if (z <= -7e+179) {
		tmp = (x + 1.0) - (z * y);
	} else if ((z <= -1.15e+142) || !(z <= 1.42e+88)) {
		tmp = t_0;
	} else {
		tmp = x + Math.cos(y);
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 1.0 - (z * math.sin(y))
	tmp = 0
	if z <= -1.8e+225:
		tmp = t_0
	elif z <= -7e+179:
		tmp = (x + 1.0) - (z * y)
	elif (z <= -1.15e+142) or not (z <= 1.42e+88):
		tmp = t_0
	else:
		tmp = x + math.cos(y)
	return tmp
function code(x, y, z)
	t_0 = Float64(1.0 - Float64(z * sin(y)))
	tmp = 0.0
	if (z <= -1.8e+225)
		tmp = t_0;
	elseif (z <= -7e+179)
		tmp = Float64(Float64(x + 1.0) - Float64(z * y));
	elseif ((z <= -1.15e+142) || !(z <= 1.42e+88))
		tmp = t_0;
	else
		tmp = Float64(x + cos(y));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 1.0 - (z * sin(y));
	tmp = 0.0;
	if (z <= -1.8e+225)
		tmp = t_0;
	elseif (z <= -7e+179)
		tmp = (x + 1.0) - (z * y);
	elseif ((z <= -1.15e+142) || ~((z <= 1.42e+88)))
		tmp = t_0;
	else
		tmp = x + cos(y);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.8e+225], t$95$0, If[LessEqual[z, -7e+179], N[(N[(x + 1.0), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -1.15e+142], N[Not[LessEqual[z, 1.42e+88]], $MachinePrecision]], t$95$0, N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 1 - z \cdot \sin y\\
\mathbf{if}\;z \leq -1.8 \cdot 10^{+225}:\\
\;\;\;\;t\_0\\

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

\mathbf{elif}\;z \leq -1.15 \cdot 10^{+142} \lor \neg \left(z \leq 1.42 \cdot 10^{+88}\right):\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.7999999999999999e225 or -7.0000000000000003e179 < z < -1.15000000000000001e142 or 1.41999999999999996e88 < z

    1. Initial program 99.8%

      \[\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. associate-*r*99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{z \cdot \left(\frac{1}{z} - \sin y\right)} \]
    8. Step-by-step derivation
      1. sub-neg82.3%

        \[\leadsto z \cdot \color{blue}{\left(\frac{1}{z} + \left(-\sin y\right)\right)} \]
      2. distribute-lft-in82.4%

        \[\leadsto \color{blue}{z \cdot \frac{1}{z} + z \cdot \left(-\sin y\right)} \]
      3. rgt-mult-inverse82.4%

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

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

    if -1.7999999999999999e225 < z < -7.0000000000000003e179

    1. Initial program 100.0%

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

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

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

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

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

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

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

    if -1.15000000000000001e142 < z < 1.41999999999999996e88

    1. Initial program 100.0%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.8 \cdot 10^{+225}:\\ \;\;\;\;1 - z \cdot \sin y\\ \mathbf{elif}\;z \leq -7 \cdot 10^{+179}:\\ \;\;\;\;\left(x + 1\right) - z \cdot y\\ \mathbf{elif}\;z \leq -1.15 \cdot 10^{+142} \lor \neg \left(z \leq 1.42 \cdot 10^{+88}\right):\\ \;\;\;\;1 - z \cdot \sin y\\ \mathbf{else}:\\ \;\;\;\;x + \cos y\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 81.9% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \sin \left(-y\right)\\ \mathbf{if}\;z \leq -1.8 \cdot 10^{+225}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -4.05 \cdot 10^{+183}:\\ \;\;\;\;\left(x + 1\right) - z \cdot y\\ \mathbf{elif}\;z \leq -4.8 \cdot 10^{+142} \lor \neg \left(z \leq 1.2 \cdot 10^{+88}\right):\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;x + \cos y\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* z (sin (- y)))))
   (if (<= z -1.8e+225)
     t_0
     (if (<= z -4.05e+183)
       (- (+ x 1.0) (* z y))
       (if (or (<= z -4.8e+142) (not (<= z 1.2e+88))) t_0 (+ x (cos y)))))))
double code(double x, double y, double z) {
	double t_0 = z * sin(-y);
	double tmp;
	if (z <= -1.8e+225) {
		tmp = t_0;
	} else if (z <= -4.05e+183) {
		tmp = (x + 1.0) - (z * y);
	} else if ((z <= -4.8e+142) || !(z <= 1.2e+88)) {
		tmp = t_0;
	} else {
		tmp = x + 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) :: t_0
    real(8) :: tmp
    t_0 = z * sin(-y)
    if (z <= (-1.8d+225)) then
        tmp = t_0
    else if (z <= (-4.05d+183)) then
        tmp = (x + 1.0d0) - (z * y)
    else if ((z <= (-4.8d+142)) .or. (.not. (z <= 1.2d+88))) then
        tmp = t_0
    else
        tmp = x + cos(y)
    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 (z <= -1.8e+225) {
		tmp = t_0;
	} else if (z <= -4.05e+183) {
		tmp = (x + 1.0) - (z * y);
	} else if ((z <= -4.8e+142) || !(z <= 1.2e+88)) {
		tmp = t_0;
	} else {
		tmp = x + Math.cos(y);
	}
	return tmp;
}
def code(x, y, z):
	t_0 = z * math.sin(-y)
	tmp = 0
	if z <= -1.8e+225:
		tmp = t_0
	elif z <= -4.05e+183:
		tmp = (x + 1.0) - (z * y)
	elif (z <= -4.8e+142) or not (z <= 1.2e+88):
		tmp = t_0
	else:
		tmp = x + math.cos(y)
	return tmp
function code(x, y, z)
	t_0 = Float64(z * sin(Float64(-y)))
	tmp = 0.0
	if (z <= -1.8e+225)
		tmp = t_0;
	elseif (z <= -4.05e+183)
		tmp = Float64(Float64(x + 1.0) - Float64(z * y));
	elseif ((z <= -4.8e+142) || !(z <= 1.2e+88))
		tmp = t_0;
	else
		tmp = Float64(x + cos(y));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = z * sin(-y);
	tmp = 0.0;
	if (z <= -1.8e+225)
		tmp = t_0;
	elseif (z <= -4.05e+183)
		tmp = (x + 1.0) - (z * y);
	elseif ((z <= -4.8e+142) || ~((z <= 1.2e+88)))
		tmp = t_0;
	else
		tmp = x + cos(y);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Sin[(-y)], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.8e+225], t$95$0, If[LessEqual[z, -4.05e+183], N[(N[(x + 1.0), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -4.8e+142], N[Not[LessEqual[z, 1.2e+88]], $MachinePrecision]], t$95$0, N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := z \cdot \sin \left(-y\right)\\
\mathbf{if}\;z \leq -1.8 \cdot 10^{+225}:\\
\;\;\;\;t\_0\\

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

\mathbf{elif}\;z \leq -4.8 \cdot 10^{+142} \lor \neg \left(z \leq 1.2 \cdot 10^{+88}\right):\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.7999999999999999e225 or -4.04999999999999997e183 < z < -4.7999999999999998e142 or 1.2e88 < 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(-z\right) \cdot \sin y + \left(x + \cos y\right)} \]
      3. distribute-lft-neg-out99.8%

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

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

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

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

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

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

    if -1.7999999999999999e225 < z < -4.04999999999999997e183

    1. Initial program 100.0%

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

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

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

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

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

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

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

    if -4.7999999999999998e142 < z < 1.2e88

    1. Initial program 100.0%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.8 \cdot 10^{+225}:\\ \;\;\;\;z \cdot \sin \left(-y\right)\\ \mathbf{elif}\;z \leq -4.05 \cdot 10^{+183}:\\ \;\;\;\;\left(x + 1\right) - z \cdot y\\ \mathbf{elif}\;z \leq -4.8 \cdot 10^{+142} \lor \neg \left(z \leq 1.2 \cdot 10^{+88}\right):\\ \;\;\;\;z \cdot \sin \left(-y\right)\\ \mathbf{else}:\\ \;\;\;\;x + \cos y\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 99.1% accurate, 1.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.6499999999999999 or 3.50000000000000017e-16 < z

    1. Initial program 99.8%

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

      \[\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. associate-*r*99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.6499999999999999 < z < 3.50000000000000017e-16

    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.2%

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

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

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

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

Alternative 7: 99.1% accurate, 1.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -0.819999999999999951 or 3.50000000000000017e-16 < z

    1. Initial program 99.8%

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

      \[\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. associate-*r*99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.819999999999999951 < z < 3.50000000000000017e-16

    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.2%

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

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

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

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

Alternative 8: 92.0% accurate, 1.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.50000000000000002e77 or 2.85e69 < z

    1. Initial program 99.8%

      \[\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. associate-*r*99.6%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto z \cdot \left(\frac{x + \cos y}{z} + \color{blue}{\left(-\sin y\right)}\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 86.4%

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

    if -2.50000000000000002e77 < z < 2.85e69

    1. Initial program 100.0%

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

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

        \[\leadsto \color{blue}{\cos y + x} \]
    5. Simplified95.4%

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

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

Alternative 9: 80.6% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.62 \lor \neg \left(y \leq 0.0072\right):\\
\;\;\;\;x + \cos y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -0.619999999999999996 or 0.0071999999999999998 < y

    1. Initial program 99.8%

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

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

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

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

    if -0.619999999999999996 < y < 0.0071999999999999998

    1. Initial program 100.0%

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

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

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

Alternative 10: 71.0% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.8 \cdot 10^{-12} \lor \neg \left(x \leq 1.6 \cdot 10^{-42}\right):\\
\;\;\;\;x + 1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.79999999999999996e-12 or 1.60000000000000012e-42 < 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 75.8%

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

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

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

    if -3.79999999999999996e-12 < x < 1.60000000000000012e-42

    1. Initial program 99.9%

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

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

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

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

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

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

Alternative 11: 68.8% accurate, 7.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.7000000000000002e22 or 1.2999999999999999e68 < 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 39.3%

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

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

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

    if -2.7000000000000002e22 < y < 1.2999999999999999e68

    1. Initial program 100.0%

      \[\left(x + \cos y\right) - z \cdot \sin y \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 92.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 simplification67.9%

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

Alternative 12: 68.9% accurate, 9.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -4.1 \cdot 10^{+24} \lor \neg \left(y \leq 1.8 \cdot 10^{+68}\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 -4.1e+24) (not (<= y 1.8e+68)))
   (+ x 1.0)
   (+ 1.0 (+ x (* y (- (* y -0.5) z))))))
double code(double x, double y, double z) {
	double tmp;
	if ((y <= -4.1e+24) || !(y <= 1.8e+68)) {
		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 <= (-4.1d+24)) .or. (.not. (y <= 1.8d+68))) 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 <= -4.1e+24) || !(y <= 1.8e+68)) {
		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 <= -4.1e+24) or not (y <= 1.8e+68):
		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 <= -4.1e+24) || !(y <= 1.8e+68))
		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 <= -4.1e+24) || ~((y <= 1.8e+68)))
		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, -4.1e+24], N[Not[LessEqual[y, 1.8e+68]], $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 -4.1 \cdot 10^{+24} \lor \neg \left(y \leq 1.8 \cdot 10^{+68}\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 < -4.1000000000000001e24 or 1.7999999999999999e68 < 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 39.0%

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

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

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

    if -4.1000000000000001e24 < y < 1.7999999999999999e68

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4.1 \cdot 10^{+24} \lor \neg \left(y \leq 1.8 \cdot 10^{+68}\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: 69.3% accurate, 12.1× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -6.50000000000000005e25 or 0.0071999999999999998 < 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 37.9%

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

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

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

    if -6.50000000000000005e25 < y < 0.0071999999999999998

    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.3%

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

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

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

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

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

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

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

Alternative 14: 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 59.5%

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

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

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

Alternative 15: 42.2% accurate, 207.0× speedup?

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

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

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

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

Reproduce

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