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

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

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

Alternative 2: 99.1% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_0 := z \cdot \sin y\\
\mathbf{if}\;x \leq -1.15 \cdot 10^{-7} \lor \neg \left(x \leq 3.55 \cdot 10^{-9}\right):\\
\;\;\;\;\left(x + 1\right) - t\_0\\

\mathbf{else}:\\
\;\;\;\;\cos y - t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.14999999999999997e-7 or 3.54999999999999994e-9 < x

    1. Initial program 99.9%

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

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

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

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

    if -1.14999999999999997e-7 < x < 3.54999999999999994e-9

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

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

Alternative 3: 80.9% accurate, 1.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.15 \cdot 10^{+81} \lor \neg \left(z \leq 61000 \lor \neg \left(z \leq 9.5 \cdot 10^{+55}\right) \land z \leq 5.2 \cdot 10^{+95}\right):\\
\;\;\;\;\sin y \cdot \left(-z\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.1500000000000002e81 or 61000 < z < 9.49999999999999989e55 or 5.19999999999999981e95 < z

    1. Initial program 99.8%

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

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

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

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

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

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

    if -3.1500000000000002e81 < z < 61000 or 9.49999999999999989e55 < z < 5.19999999999999981e95

    1. Initial program 100.0%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.15 \cdot 10^{+81} \lor \neg \left(z \leq 61000 \lor \neg \left(z \leq 9.5 \cdot 10^{+55}\right) \land z \leq 5.2 \cdot 10^{+95}\right):\\ \;\;\;\;\sin y \cdot \left(-z\right)\\ \mathbf{else}:\\ \;\;\;\;x + \cos y\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 99.4% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -700000 \lor \neg \left(z \leq 0.05\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 -700000.0) (not (<= z 0.05)))
   (- (+ x 1.0) (* z (sin y)))
   (+ x (cos y))))
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -700000.0) || !(z <= 0.05)) {
		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 <= (-700000.0d0)) .or. (.not. (z <= 0.05d0))) 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 <= -700000.0) || !(z <= 0.05)) {
		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 <= -700000.0) or not (z <= 0.05):
		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 <= -700000.0) || !(z <= 0.05))
		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 <= -700000.0) || ~((z <= 0.05)))
		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, -700000.0], N[Not[LessEqual[z, 0.05]], $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 -700000 \lor \neg \left(z \leq 0.05\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 < -7e5 or 0.050000000000000003 < 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 98.7%

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

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

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

    if -7e5 < z < 0.050000000000000003

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

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

Alternative 5: 93.5% accurate, 1.8× speedup?

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

    1. Initial program 99.8%

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

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

    if -3.2e11 < z < 2500

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

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

Alternative 6: 80.6% accurate, 1.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -0.00160000000000000008 or 0.57999999999999996 < 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 58.7%

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

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

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

    if -0.00160000000000000008 < y < 0.57999999999999996

    1. Initial program 100.0%

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

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

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

Alternative 7: 69.7% accurate, 7.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.3e10 or 18 < y

    1. Initial program 99.9%

      \[\left(x + \cos y\right) - z \cdot \sin y \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-cube-cbrt97.9%

        \[\leadsto \color{blue}{\left(\sqrt[3]{\left(x + \cos y\right) - z \cdot \sin y} \cdot \sqrt[3]{\left(x + \cos y\right) - z \cdot \sin y}\right) \cdot \sqrt[3]{\left(x + \cos y\right) - z \cdot \sin y}} \]
      2. pow398.0%

        \[\leadsto \color{blue}{{\left(\sqrt[3]{\left(x + \cos y\right) - z \cdot \sin y}\right)}^{3}} \]
      3. associate--l+98.0%

        \[\leadsto {\left(\sqrt[3]{\color{blue}{x + \left(\cos y - z \cdot \sin y\right)}}\right)}^{3} \]
    4. Applied egg-rr98.0%

      \[\leadsto \color{blue}{{\left(\sqrt[3]{x + \left(\cos y - z \cdot \sin y\right)}\right)}^{3}} \]
    5. Taylor expanded in y around 0 40.4%

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

        \[\leadsto \color{blue}{x + 1} \]
    7. Simplified40.4%

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

    if -2.3e10 < y < 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 97.8%

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

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

Alternative 8: 69.6% accurate, 9.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -140000000000:\\ \;\;\;\;x + 1\\ \mathbf{elif}\;y \leq 160000000:\\ \;\;\;\;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 -140000000000.0)
   (+ x 1.0)
   (if (<= y 160000000.0)
     (+ 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 <= -140000000000.0) {
		tmp = x + 1.0;
	} else if (y <= 160000000.0) {
		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 <= (-140000000000.0d0)) then
        tmp = x + 1.0d0
    else if (y <= 160000000.0d0) 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 <= -140000000000.0) {
		tmp = x + 1.0;
	} else if (y <= 160000000.0) {
		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 <= -140000000000.0:
		tmp = x + 1.0
	elif y <= 160000000.0:
		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 <= -140000000000.0)
		tmp = Float64(x + 1.0);
	elseif (y <= 160000000.0)
		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 <= -140000000000.0)
		tmp = x + 1.0;
	elseif (y <= 160000000.0)
		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, -140000000000.0], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 160000000.0], 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 -140000000000:\\
\;\;\;\;x + 1\\

\mathbf{elif}\;y \leq 160000000:\\
\;\;\;\;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 < -1.4e11

    1. Initial program 99.9%

      \[\left(x + \cos y\right) - z \cdot \sin y \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-cube-cbrt97.8%

        \[\leadsto \color{blue}{\left(\sqrt[3]{\left(x + \cos y\right) - z \cdot \sin y} \cdot \sqrt[3]{\left(x + \cos y\right) - z \cdot \sin y}\right) \cdot \sqrt[3]{\left(x + \cos y\right) - z \cdot \sin y}} \]
      2. pow397.9%

        \[\leadsto \color{blue}{{\left(\sqrt[3]{\left(x + \cos y\right) - z \cdot \sin y}\right)}^{3}} \]
      3. associate--l+97.9%

        \[\leadsto {\left(\sqrt[3]{\color{blue}{x + \left(\cos y - z \cdot \sin y\right)}}\right)}^{3} \]
    4. Applied egg-rr97.9%

      \[\leadsto \color{blue}{{\left(\sqrt[3]{x + \left(\cos y - z \cdot \sin y\right)}\right)}^{3}} \]
    5. Taylor expanded in y around 0 39.7%

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

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

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

    if -1.4e11 < y < 1.6e8

    1. Initial program 100.0%

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

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

    if 1.6e8 < y

    1. Initial program 99.8%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -140000000000:\\ \;\;\;\;x + 1\\ \mathbf{elif}\;y \leq 160000000:\\ \;\;\;\;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.5% accurate, 12.1× speedup?

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

    1. Initial program 99.9%

      \[\left(x + \cos y\right) - z \cdot \sin y \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-cube-cbrt97.9%

        \[\leadsto \color{blue}{\left(\sqrt[3]{\left(x + \cos y\right) - z \cdot \sin y} \cdot \sqrt[3]{\left(x + \cos y\right) - z \cdot \sin y}\right) \cdot \sqrt[3]{\left(x + \cos y\right) - z \cdot \sin y}} \]
      2. pow398.0%

        \[\leadsto \color{blue}{{\left(\sqrt[3]{\left(x + \cos y\right) - z \cdot \sin y}\right)}^{3}} \]
      3. associate--l+98.0%

        \[\leadsto {\left(\sqrt[3]{\color{blue}{x + \left(\cos y - z \cdot \sin y\right)}}\right)}^{3} \]
    4. Applied egg-rr98.0%

      \[\leadsto \color{blue}{{\left(\sqrt[3]{x + \left(\cos y - z \cdot \sin y\right)}\right)}^{3}} \]
    5. Taylor expanded in y around 0 40.3%

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

        \[\leadsto \color{blue}{x + 1} \]
    7. Simplified40.3%

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

    if -7.2e21 < y < 5800

    1. Initial program 100.0%

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

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

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

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

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

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

Alternative 10: 66.6% accurate, 13.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.7000000000000002e-42 or 0.0189999999999999995 < x

    1. Initial program 99.9%

      \[\left(x + \cos y\right) - z \cdot \sin y \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-cube-cbrt98.1%

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

        \[\leadsto \color{blue}{{\left(\sqrt[3]{\left(x + \cos y\right) - z \cdot \sin y}\right)}^{3}} \]
      3. associate--l+98.1%

        \[\leadsto {\left(\sqrt[3]{\color{blue}{x + \left(\cos y - z \cdot \sin y\right)}}\right)}^{3} \]
    4. Applied egg-rr98.1%

      \[\leadsto \color{blue}{{\left(\sqrt[3]{x + \left(\cos y - z \cdot \sin y\right)}\right)}^{3}} \]
    5. Taylor expanded in y around 0 79.9%

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

        \[\leadsto \color{blue}{x + 1} \]
    7. Simplified79.9%

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

    if -3.7000000000000002e-42 < x < 0.0189999999999999995

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 62.2% accurate, 23.0× speedup?

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

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

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


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

    1. Initial program 99.9%

      \[\left(x + \cos y\right) - z \cdot \sin y \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-cube-cbrt98.4%

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

        \[\leadsto \color{blue}{{\left(\sqrt[3]{\left(x + \cos y\right) - z \cdot \sin y}\right)}^{3}} \]
      3. associate--l+98.5%

        \[\leadsto {\left(\sqrt[3]{\color{blue}{x + \left(\cos y - z \cdot \sin y\right)}}\right)}^{3} \]
    4. Applied egg-rr98.5%

      \[\leadsto \color{blue}{{\left(\sqrt[3]{x + \left(\cos y - z \cdot \sin y\right)}\right)}^{3}} \]
    5. Taylor expanded in y around 0 62.3%

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

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

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

    if 3.99999999999999971e210 < z

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 4 \cdot 10^{+210}:\\ \;\;\;\;x + 1\\ \mathbf{else}:\\ \;\;\;\;-y \cdot z\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 61.6% 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. Step-by-step derivation
    1. add-cube-cbrt98.4%

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

      \[\leadsto \color{blue}{{\left(\sqrt[3]{\left(x + \cos y\right) - z \cdot \sin y}\right)}^{3}} \]
    3. associate--l+98.5%

      \[\leadsto {\left(\sqrt[3]{\color{blue}{x + \left(\cos y - z \cdot \sin y\right)}}\right)}^{3} \]
  4. Applied egg-rr98.5%

    \[\leadsto \color{blue}{{\left(\sqrt[3]{x + \left(\cos y - z \cdot \sin y\right)}\right)}^{3}} \]
  5. Taylor expanded in y around 0 58.5%

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

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

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

    \[\leadsto x + 1 \]
  9. Add Preprocessing

Alternative 13: 42.9% accurate, 207.0× speedup?

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

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

    \[\left(x + \cos y\right) - z \cdot \sin y \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. add-cube-cbrt98.4%

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

      \[\leadsto \color{blue}{{\left(\sqrt[3]{\left(x + \cos y\right) - z \cdot \sin y}\right)}^{3}} \]
    3. associate--l+98.5%

      \[\leadsto {\left(\sqrt[3]{\color{blue}{x + \left(\cos y - z \cdot \sin y\right)}}\right)}^{3} \]
  4. Applied egg-rr98.5%

    \[\leadsto \color{blue}{{\left(\sqrt[3]{x + \left(\cos y - z \cdot \sin y\right)}\right)}^{3}} \]
  5. Taylor expanded in x around inf 37.6%

    \[\leadsto \color{blue}{x} \]
  6. Final simplification37.6%

    \[\leadsto x \]
  7. Add Preprocessing

Reproduce

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