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

Percentage Accurate: 99.9% → 99.9%
Time: 8.3s
Alternatives: 12
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 12 alternatives:

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

Initial Program: 99.9% accurate, 1.0× speedup?

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

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

Alternative 1: 99.9% accurate, 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 100.0%

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

Alternative 2: 99.0% accurate, 1.0× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -4.8000000000000001e-16 or 2.1e-18 < x

    1. Initial program 100.0%

      \[\left(x + \cos y\right) - z \cdot \sin y \]
    2. Add Preprocessing
    3. Taylor expanded in z around -inf 79.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. mul-1-neg79.2%

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

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

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

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

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

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

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

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

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

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

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

    if -4.8000000000000001e-16 < x < 2.1e-18

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

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

Alternative 3: 99.0% accurate, 1.7× speedup?

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

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.41999999999999992e32 < z < 10.5

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

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

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

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

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

Alternative 4: 91.6% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -6.2 \cdot 10^{+95} \lor \neg \left(z \leq 1.6 \cdot 10^{+74}\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 -6.2e+95) (not (<= z 1.6e+74)))
   (* z (- (/ x z) (sin y)))
   (+ x (cos y))))
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -6.2e+95) || !(z <= 1.6e+74)) {
		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 <= (-6.2d+95)) .or. (.not. (z <= 1.6d+74))) 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 <= -6.2e+95) || !(z <= 1.6e+74)) {
		tmp = z * ((x / z) - Math.sin(y));
	} else {
		tmp = x + Math.cos(y);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (z <= -6.2e+95) or not (z <= 1.6e+74):
		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 <= -6.2e+95) || !(z <= 1.6e+74))
		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 <= -6.2e+95) || ~((z <= 1.6e+74)))
		tmp = z * ((x / z) - sin(y));
	else
		tmp = x + cos(y);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[z, -6.2e+95], N[Not[LessEqual[z, 1.6e+74]], $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 -6.2 \cdot 10^{+95} \lor \neg \left(z \leq 1.6 \cdot 10^{+74}\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 < -6.2000000000000006e95 or 1.59999999999999997e74 < z

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

    if -6.2000000000000006e95 < z < 1.59999999999999997e74

    1. Initial program 100.0%

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

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

        \[\leadsto \color{blue}{\cos y + x} \]
    5. Simplified94.9%

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

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

Alternative 5: 80.6% accurate, 1.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -0.012500000000000001 or 1.40000000000000006e-18 < y

    1. Initial program 99.9%

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

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

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

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

    if -0.012500000000000001 < y < 1.40000000000000006e-18

    1. Initial program 100.0%

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

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

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

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

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

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

Alternative 6: 71.9% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.5 \cdot 10^{-34} \lor \neg \left(x \leq 2.1 \cdot 10^{-18}\right):\\
\;\;\;\;x + 1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -9.49999999999999985e-34 or 2.1e-18 < x

    1. Initial program 100.0%

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

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

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

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

    if -9.49999999999999985e-34 < x < 2.1e-18

    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} \]
    4. Taylor expanded in z around 0 76.5%

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

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

Alternative 7: 69.8% accurate, 9.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -3 \cdot 10^{+36} \lor \neg \left(y \leq 0.195\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 -3e+36) (not (<= y 0.195)))
   (+ x 1.0)
   (+ 1.0 (+ x (* y (- (* y -0.5) z))))))
double code(double x, double y, double z) {
	double tmp;
	if ((y <= -3e+36) || !(y <= 0.195)) {
		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 <= (-3d+36)) .or. (.not. (y <= 0.195d0))) 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 <= -3e+36) || !(y <= 0.195)) {
		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 <= -3e+36) or not (y <= 0.195):
		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 <= -3e+36) || !(y <= 0.195))
		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 <= -3e+36) || ~((y <= 0.195)))
		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, -3e+36], N[Not[LessEqual[y, 0.195]], $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 -3 \cdot 10^{+36} \lor \neg \left(y \leq 0.195\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 < -3e36 or 0.19500000000000001 < y

    1. Initial program 99.9%

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

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

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

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

    if -3e36 < y < 0.19500000000000001

    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 + y \cdot \left(-0.5 \cdot y - z\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification74.2%

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

Alternative 8: 69.8% accurate, 12.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.8 \cdot 10^{+36} \lor \neg \left(y \leq 3.25 \cdot 10^{+42}\right):\\
\;\;\;\;x + 1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -9.79999999999999962e36 or 3.25000000000000026e42 < y

    1. Initial program 99.9%

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

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

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

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

    if -9.79999999999999962e36 < y < 3.25000000000000026e42

    1. Initial program 100.0%

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

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

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

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

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

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

Alternative 9: 67.1% accurate, 13.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.2 \cdot 10^{-16} \lor \neg \left(x \leq 1.02 \cdot 10^{-24}\right):\\
\;\;\;\;x + 1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.2e-16 or 1.0200000000000001e-24 < x

    1. Initial program 100.0%

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

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

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

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

    if -2.2e-16 < x < 1.0200000000000001e-24

    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} \]
    4. Taylor expanded in y around 0 55.8%

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

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

        \[\leadsto \color{blue}{1 - y \cdot z} \]
    6. Simplified55.8%

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

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

Alternative 10: 61.0% accurate, 18.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -0.98:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z) :precision binary64 (if (<= x -0.98) x (if (<= x 1.0) 1.0 x)))
double code(double x, double y, double z) {
	double tmp;
	if (x <= -0.98) {
		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.98d0)) 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.98) {
		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.98:
		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.98)
		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.98)
		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.98], x, If[LessEqual[x, 1.0], 1.0, x]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.98:\\
\;\;\;\;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.97999999999999998 or 1 < x

    1. Initial program 100.0%

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

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

    if -0.97999999999999998 < x < 1

    1. Initial program 99.9%

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

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

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

Alternative 11: 61.8% accurate, 69.0× speedup?

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

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

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

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

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

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

Alternative 12: 21.7% 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 100.0%

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

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

    \[\leadsto \color{blue}{1} \]
  5. Add Preprocessing

Reproduce

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