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

Percentage Accurate: 99.9% → 99.9%
Time: 8.3s
Alternatives: 14
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 14 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. Add Preprocessing
  3. Add Preprocessing

Alternative 2: 98.7% accurate, 1.8× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -6.20000000000000035e38 or 6.60000000000000034e-6 < z

    1. Initial program 99.9%

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

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

    if -6.20000000000000035e38 < z < 6.60000000000000034e-6

    1. Initial program 100.0%

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

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

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

      \[\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 -6.2 \cdot 10^{+38} \lor \neg \left(z \leq 6.6 \cdot 10^{-6}\right):\\ \;\;\;\;\left(x + 1\right) - z \cdot \sin y\\ \mathbf{else}:\\ \;\;\;\;x + \cos y\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 93.6% accurate, 1.8× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.6500000000000001e39 or 2.2000000000000002e34 < 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 84.9%

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

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

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

        \[\leadsto \color{blue}{x - z \cdot \sin y} \]
    9. Simplified84.9%

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

    if -1.6500000000000001e39 < z < 2.2000000000000002e34

    1. Initial program 100.0%

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

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

        \[\leadsto \color{blue}{\cos y + x} \]
    5. Simplified97.3%

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

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

Alternative 4: 84.2% accurate, 1.8× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.2e49 or 3.7e15 < z

    1. Initial program 99.9%

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

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

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

    if -1.2e49 < z < 3.7e15

    1. Initial program 100.0%

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

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

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

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

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

Alternative 5: 81.3% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -3.45 \cdot 10^{-7} \lor \neg \left(y \leq 6.5 \cdot 10^{-11}\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 -3.45e-7) (not (<= y 6.5e-11)))
   (+ x (cos y))
   (+ 1.0 (- x (* y z)))))
double code(double x, double y, double z) {
	double tmp;
	if ((y <= -3.45e-7) || !(y <= 6.5e-11)) {
		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 <= (-3.45d-7)) .or. (.not. (y <= 6.5d-11))) 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 <= -3.45e-7) || !(y <= 6.5e-11)) {
		tmp = x + Math.cos(y);
	} else {
		tmp = 1.0 + (x - (y * z));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (y <= -3.45e-7) or not (y <= 6.5e-11):
		tmp = x + math.cos(y)
	else:
		tmp = 1.0 + (x - (y * z))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((y <= -3.45e-7) || !(y <= 6.5e-11))
		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 <= -3.45e-7) || ~((y <= 6.5e-11)))
		tmp = x + cos(y);
	else
		tmp = 1.0 + (x - (y * z));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[y, -3.45e-7], N[Not[LessEqual[y, 6.5e-11]], $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 -3.45 \cdot 10^{-7} \lor \neg \left(y \leq 6.5 \cdot 10^{-11}\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 < -3.4499999999999998e-7 or 6.49999999999999953e-11 < 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 64.6%

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

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

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

    if -3.4499999999999998e-7 < y < 6.49999999999999953e-11

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

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

Alternative 6: 80.6% accurate, 1.8× speedup?

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

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

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


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

    1. Initial program 99.9%

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

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

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

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

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

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

    if -2.54999999999999997e101 < z < 5.5000000000000002e24

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

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

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

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

    if 5.5000000000000002e24 < z

    1. Initial program 99.8%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.55 \cdot 10^{+101}:\\ \;\;\;\;\sin y \cdot \left(-z\right)\\ \mathbf{elif}\;z \leq 5.5 \cdot 10^{+24}:\\ \;\;\;\;x + \cos y\\ \mathbf{else}:\\ \;\;\;\;1 + \left(x - y \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 72.4% accurate, 1.9× speedup?

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

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

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

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


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

    1. Initial program 99.9%

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

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

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

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

    if -1.84999999999999994e-13 < x < 0.97999999999999998

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

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

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

    if 0.97999999999999998 < 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 83.7%

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

Alternative 8: 69.6% accurate, 9.8× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 + \frac{1}{x}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -3.1e26

    1. Initial program 99.8%

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

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

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

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

    if -3.1e26 < y < 6.49999999999999953e-11

    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 + y \cdot \left(-0.5 \cdot y - z\right)\right)} \]

    if 6.49999999999999953e-11 < 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 45.8%

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

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

      \[\leadsto \color{blue}{x + 1} \]
    6. Taylor expanded in x around inf 45.8%

      \[\leadsto \color{blue}{x \cdot \left(1 + \frac{1}{x}\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification69.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.1 \cdot 10^{+26}:\\ \;\;\;\;x + 1\\ \mathbf{elif}\;y \leq 6.5 \cdot 10^{-11}:\\ \;\;\;\;1 + \left(x + y \cdot \left(y \cdot -0.5 - z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(1 + \frac{1}{x}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 69.8% accurate, 12.2× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 + \frac{1}{x}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -8.4000000000000002e33

    1. Initial program 99.8%

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

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

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

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

    if -8.4000000000000002e33 < y < 3.1e9

    1. Initial program 100.0%

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

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

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

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

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

    if 3.1e9 < 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 45.4%

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

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

      \[\leadsto \color{blue}{x + 1} \]
    6. Taylor expanded in x around inf 45.4%

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

Alternative 10: 66.7% accurate, 12.2× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 + \frac{1}{x}\right)\\


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

    1. Initial program 99.9%

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

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

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

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

    if -2.4e9 < x < 9.99999999999999955e-7

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

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

      \[\leadsto \color{blue}{1} - z \cdot \sin y \]
    5. Taylor expanded in y around 0 55.8%

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

    if 9.99999999999999955e-7 < 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 81.6%

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

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

      \[\leadsto \color{blue}{x + 1} \]
    6. Taylor expanded in x around inf 81.6%

      \[\leadsto \color{blue}{x \cdot \left(1 + \frac{1}{x}\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification66.6%

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

Alternative 11: 66.6% accurate, 13.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2e10 or 3.49999999999999996e-4 < 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 78.0%

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

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

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

    if -2e10 < x < 3.49999999999999996e-4

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

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

      \[\leadsto \color{blue}{1} - z \cdot \sin y \]
    5. Taylor expanded in y around 0 55.8%

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

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

Alternative 12: 60.8% accurate, 18.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.95:\\
\;\;\;\;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.94999999999999996 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 78.3%

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

    if -0.94999999999999996 < 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.4%

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

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

Alternative 13: 61.5% 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.7%

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

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

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

Alternative 14: 21.2% 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. Add Preprocessing
  3. Taylor expanded in x around 0 62.0%

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

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

Reproduce

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