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

Percentage Accurate: 99.9% → 99.9%
Time: 11.9s
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, 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. Final simplification99.9%

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

Alternative 2: 90.1% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.0105:\\
\;\;\;\;x + \cos y\\

\mathbf{elif}\;x \leq 5.6 \cdot 10^{+40}:\\
\;\;\;\;\cos y - z \cdot \sin y\\

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


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

    1. Initial program 100.0%

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

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

        \[\leadsto \color{blue}{\cos y + x} \]
    4. Simplified81.3%

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

    if -0.0105000000000000007 < x < 5.6000000000000003e40

    1. Initial program 99.9%

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

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

    if 5.6000000000000003e40 < x

    1. Initial program 99.9%

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

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

        \[\leadsto \color{blue}{x + 1} \]
    4. Simplified88.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -0.0105:\\ \;\;\;\;x + \cos y\\ \mathbf{elif}\;x \leq 5.6 \cdot 10^{+40}:\\ \;\;\;\;\cos y - z \cdot \sin y\\ \mathbf{else}:\\ \;\;\;\;x + 1\\ \end{array} \]

Alternative 3: 82.6% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45 \cdot 10^{+172} \lor \neg \left(z \leq 6.2 \cdot 10^{+101}\right):\\
\;\;\;\;\left(1 + \left(x + -0.5 \cdot \left(y \cdot y\right)\right)\right) - z \cdot \sin y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.45e172 or 6.19999999999999998e101 < z

    1. Initial program 99.8%

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

      \[\leadsto \color{blue}{\left(1 + \left(x + -0.5 \cdot {y}^{2}\right)\right)} - z \cdot \sin y \]
    3. Step-by-step derivation
      1. unpow272.1%

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

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

    if -1.45e172 < z < 6.19999999999999998e101

    1. Initial program 99.9%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.45 \cdot 10^{+172} \lor \neg \left(z \leq 6.2 \cdot 10^{+101}\right):\\ \;\;\;\;\left(1 + \left(x + -0.5 \cdot \left(y \cdot y\right)\right)\right) - z \cdot \sin y\\ \mathbf{else}:\\ \;\;\;\;x + \cos y\\ \end{array} \]

Alternative 4: 80.5% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -170000000 \lor \neg \left(y \leq 3600000000000\right):\\ \;\;\;\;x + \cos y\\ \mathbf{else}:\\ \;\;\;\;1 + \mathsf{fma}\left(-y, z, x\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= y -170000000.0) (not (<= y 3600000000000.0)))
   (+ x (cos y))
   (+ 1.0 (fma (- y) z x))))
double code(double x, double y, double z) {
	double tmp;
	if ((y <= -170000000.0) || !(y <= 3600000000000.0)) {
		tmp = x + cos(y);
	} else {
		tmp = 1.0 + fma(-y, z, x);
	}
	return tmp;
}
function code(x, y, z)
	tmp = 0.0
	if ((y <= -170000000.0) || !(y <= 3600000000000.0))
		tmp = Float64(x + cos(y));
	else
		tmp = Float64(1.0 + fma(Float64(-y), z, x));
	end
	return tmp
end
code[x_, y_, z_] := If[Or[LessEqual[y, -170000000.0], N[Not[LessEqual[y, 3600000000000.0]], $MachinePrecision]], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(1.0 + N[((-y) * z + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.7e8 or 3.6e12 < y

    1. Initial program 99.9%

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

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

        \[\leadsto \color{blue}{\cos y + x} \]
    4. Simplified64.9%

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

    if -1.7e8 < y < 3.6e12

    1. Initial program 100.0%

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

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

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

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

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

        \[\leadsto 1 + \mathsf{fma}\left(\color{blue}{-y}, z, x\right) \]
    4. Simplified96.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -170000000 \lor \neg \left(y \leq 3600000000000\right):\\ \;\;\;\;x + \cos y\\ \mathbf{else}:\\ \;\;\;\;1 + \mathsf{fma}\left(-y, z, x\right)\\ \end{array} \]

Alternative 5: 80.5% accurate, 1.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -6.6e6 or 3.6e12 < y

    1. Initial program 99.9%

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

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

        \[\leadsto \color{blue}{\cos y + x} \]
    4. Simplified64.9%

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

    if -6.6e6 < y < 3.6e12

    1. Initial program 100.0%

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

        \[\leadsto \color{blue}{\frac{{\left(x + \cos y\right)}^{3} - {\left(z \cdot \sin y\right)}^{3}}{\left(x + \cos y\right) \cdot \left(x + \cos y\right) + \left(\left(z \cdot \sin y\right) \cdot \left(z \cdot \sin y\right) + \left(x + \cos y\right) \cdot \left(z \cdot \sin y\right)\right)}} \]
      2. clear-num49.4%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(1 + x\right) - \color{blue}{z \cdot y} \]
    8. Applied egg-rr96.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -6600000 \lor \neg \left(y \leq 3600000000000\right):\\ \;\;\;\;x + \cos y\\ \mathbf{else}:\\ \;\;\;\;\left(x + 1\right) - y \cdot z\\ \end{array} \]

Alternative 6: 71.8% accurate, 2.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.05 \cdot 10^{-15}:\\
\;\;\;\;x + 1\\

\mathbf{elif}\;x \leq 0.00095:\\
\;\;\;\;\cos y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.0499999999999999e-15 or 9.49999999999999998e-4 < x

    1. Initial program 99.9%

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

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

        \[\leadsto \color{blue}{x + 1} \]
    4. Simplified80.2%

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

    if -1.0499999999999999e-15 < x < 9.49999999999999998e-4

    1. Initial program 99.9%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.05 \cdot 10^{-15}:\\ \;\;\;\;x + 1\\ \mathbf{elif}\;x \leq 0.00095:\\ \;\;\;\;\cos y\\ \mathbf{else}:\\ \;\;\;\;x + 1\\ \end{array} \]

Alternative 7: 69.7% accurate, 18.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.5 \cdot 10^{+57}:\\
\;\;\;\;x + 1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.49999999999999986e57 or 8e12 < y

    1. Initial program 99.9%

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

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

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

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

    if -2.49999999999999986e57 < y < 8e12

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(1 + x\right) - \color{blue}{z \cdot y} \]
    8. Applied egg-rr92.4%

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

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

Alternative 8: 65.6% accurate, 22.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.0066:\\
\;\;\;\;x + 1\\

\mathbf{elif}\;x \leq 1.15 \cdot 10^{+36}:\\
\;\;\;\;1 - y \cdot z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -0.0066 or 1.14999999999999998e36 < x

    1. Initial program 100.0%

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

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

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

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

    if -0.0066 < x < 1.14999999999999998e36

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -0.0066:\\ \;\;\;\;x + 1\\ \mathbf{elif}\;x \leq 1.15 \cdot 10^{+36}:\\ \;\;\;\;1 - y \cdot z\\ \mathbf{else}:\\ \;\;\;\;x + 1\\ \end{array} \]

Alternative 9: 61.8% accurate, 34.1× speedup?

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

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

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


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

    1. Initial program 99.9%

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

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

        \[\leadsto \color{blue}{x + 1} \]
    4. Simplified66.2%

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

    if 1.30000000000000002e221 < z

    1. Initial program 99.9%

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

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

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

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

      \[\leadsto \color{blue}{z \cdot \left(-\sin y\right)} \]
    5. Taylor expanded in y around 0 49.3%

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

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

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

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

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

Alternative 10: 60.7% accurate, 40.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -0.0065:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= x -0.0065) x (if (<= x 1.0) 1.0 x)))
double code(double x, double y, double z) {
	double tmp;
	if (x <= -0.0065) {
		tmp = x;
	} else if (x <= 1.0) {
		tmp = 1.0;
	} else {
		tmp = x;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (x <= (-0.0065d0)) then
        tmp = x
    else if (x <= 1.0d0) then
        tmp = 1.0d0
    else
        tmp = x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (x <= -0.0065) {
		tmp = x;
	} else if (x <= 1.0) {
		tmp = 1.0;
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if x <= -0.0065:
		tmp = x
	elif x <= 1.0:
		tmp = 1.0
	else:
		tmp = x
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (x <= -0.0065)
		tmp = x;
	elseif (x <= 1.0)
		tmp = 1.0;
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (x <= -0.0065)
		tmp = x;
	elseif (x <= 1.0)
		tmp = 1.0;
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[x, -0.0065], x, If[LessEqual[x, 1.0], 1.0, x]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.0065:\\
\;\;\;\;x\\

\mathbf{elif}\;x \leq 1:\\
\;\;\;\;1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -0.0064999999999999997 or 1 < x

    1. Initial program 99.9%

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

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

    if -0.0064999999999999997 < x < 1

    1. Initial program 99.9%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -0.0065:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 11: 61.4% 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. Taylor expanded in y around 0 63.0%

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

      \[\leadsto \color{blue}{x + 1} \]
  4. Simplified63.0%

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

    \[\leadsto x + 1 \]

Alternative 12: 22.0% accurate, 207.0× speedup?

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

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

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

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

    \[\leadsto \color{blue}{1} \]
  4. Final simplification19.3%

    \[\leadsto 1 \]

Reproduce

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