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

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

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 12 alternatives:

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

Initial Program: 99.9% accurate, 1.0× speedup?

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

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

Alternative 1: 99.9% accurate, 1.0× speedup?

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

\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
Derivation
  1. Initial program 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.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \sin y\\ \mathbf{if}\;x \leq -2.5 \cdot 10^{-9} \lor \neg \left(x \leq 1.52 \cdot 10^{-16}\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 -2.5e-9) (not (<= x 1.52e-16)))
     (- (+ 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 <= -2.5e-9) || !(x <= 1.52e-16)) {
		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 <= (-2.5d-9)) .or. (.not. (x <= 1.52d-16))) 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 <= -2.5e-9) || !(x <= 1.52e-16)) {
		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 <= -2.5e-9) or not (x <= 1.52e-16):
		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 <= -2.5e-9) || !(x <= 1.52e-16))
		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 <= -2.5e-9) || ~((x <= 1.52e-16)))
		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, -2.5e-9], N[Not[LessEqual[x, 1.52e-16]], $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 -2.5 \cdot 10^{-9} \lor \neg \left(x \leq 1.52 \cdot 10^{-16}\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 < -2.5000000000000001e-9 or 1.52e-16 < 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 97.9%

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

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

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

    if -2.5000000000000001e-9 < x < 1.52e-16

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

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

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

Alternative 3: 69.4% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin y \cdot \left(-z\right)\\ \mathbf{if}\;y \leq -4.4 \cdot 10^{+264}:\\ \;\;\;\;x + 1\\ \mathbf{elif}\;y \leq -5 \cdot 10^{+101}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq -3.3 \cdot 10^{-5}:\\ \;\;\;\;x + 1\\ \mathbf{elif}\;y \leq 2 \cdot 10^{+63}:\\ \;\;\;\;\left(x + 1\right) - y \cdot z\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* (sin y) (- z))))
   (if (<= y -4.4e+264)
     (+ x 1.0)
     (if (<= y -5e+101)
       t_0
       (if (<= y -3.3e-5)
         (+ x 1.0)
         (if (<= y 2e+63) (- (+ x 1.0) (* y z)) t_0))))))
double code(double x, double y, double z) {
	double t_0 = sin(y) * -z;
	double tmp;
	if (y <= -4.4e+264) {
		tmp = x + 1.0;
	} else if (y <= -5e+101) {
		tmp = t_0;
	} else if (y <= -3.3e-5) {
		tmp = x + 1.0;
	} else if (y <= 2e+63) {
		tmp = (x + 1.0) - (y * z);
	} else {
		tmp = 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 = sin(y) * -z
    if (y <= (-4.4d+264)) then
        tmp = x + 1.0d0
    else if (y <= (-5d+101)) then
        tmp = t_0
    else if (y <= (-3.3d-5)) then
        tmp = x + 1.0d0
    else if (y <= 2d+63) then
        tmp = (x + 1.0d0) - (y * z)
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = Math.sin(y) * -z;
	double tmp;
	if (y <= -4.4e+264) {
		tmp = x + 1.0;
	} else if (y <= -5e+101) {
		tmp = t_0;
	} else if (y <= -3.3e-5) {
		tmp = x + 1.0;
	} else if (y <= 2e+63) {
		tmp = (x + 1.0) - (y * z);
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = math.sin(y) * -z
	tmp = 0
	if y <= -4.4e+264:
		tmp = x + 1.0
	elif y <= -5e+101:
		tmp = t_0
	elif y <= -3.3e-5:
		tmp = x + 1.0
	elif y <= 2e+63:
		tmp = (x + 1.0) - (y * z)
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(sin(y) * Float64(-z))
	tmp = 0.0
	if (y <= -4.4e+264)
		tmp = Float64(x + 1.0);
	elseif (y <= -5e+101)
		tmp = t_0;
	elseif (y <= -3.3e-5)
		tmp = Float64(x + 1.0);
	elseif (y <= 2e+63)
		tmp = Float64(Float64(x + 1.0) - Float64(y * z));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = sin(y) * -z;
	tmp = 0.0;
	if (y <= -4.4e+264)
		tmp = x + 1.0;
	elseif (y <= -5e+101)
		tmp = t_0;
	elseif (y <= -3.3e-5)
		tmp = x + 1.0;
	elseif (y <= 2e+63)
		tmp = (x + 1.0) - (y * z);
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Sin[y], $MachinePrecision] * (-z)), $MachinePrecision]}, If[LessEqual[y, -4.4e+264], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, -5e+101], t$95$0, If[LessEqual[y, -3.3e-5], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 2e+63], N[(N[(x + 1.0), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin y \cdot \left(-z\right)\\
\mathbf{if}\;y \leq -4.4 \cdot 10^{+264}:\\
\;\;\;\;x + 1\\

\mathbf{elif}\;y \leq -5 \cdot 10^{+101}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y \leq -3.3 \cdot 10^{-5}:\\
\;\;\;\;x + 1\\

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

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -4.4e264 or -4.99999999999999989e101 < y < -3.3000000000000003e-5

    1. Initial program 99.9%

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

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

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

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

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

    if -4.4e264 < y < -4.99999999999999989e101 or 2.00000000000000012e63 < y

    1. Initial program 99.8%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\sin y \cdot \left(-z\right)} \]
    8. Simplified49.1%

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

    if -3.3000000000000003e-5 < y < 2.00000000000000012e63

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

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

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

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

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

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

Alternative 4: 92.3% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.2 \cdot 10^{-103} \lor \neg \left(z \leq 3.2 \cdot 10^{-171}\right):\\
\;\;\;\;\left(x + 1\right) - z \cdot \sin y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.2000000000000001e-103 or 3.2000000000000001e-171 < 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 92.6%

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

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

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

    if -1.2000000000000001e-103 < z < 3.2000000000000001e-171

    1. Initial program 100.0%

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

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

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

Alternative 5: 87.4% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \sin y\\ \mathbf{if}\;x \leq -1.2 \lor \neg \left(x \leq 1.1\right):\\ \;\;\;\;x - t\_0\\ \mathbf{else}:\\ \;\;\;\;1 - t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* z (sin y))))
   (if (or (<= x -1.2) (not (<= x 1.1))) (- x t_0) (- 1.0 t_0))))
double code(double x, double y, double z) {
	double t_0 = z * sin(y);
	double tmp;
	if ((x <= -1.2) || !(x <= 1.1)) {
		tmp = x - t_0;
	} else {
		tmp = 1.0 - 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.2d0)) .or. (.not. (x <= 1.1d0))) then
        tmp = x - t_0
    else
        tmp = 1.0d0 - 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.2) || !(x <= 1.1)) {
		tmp = x - t_0;
	} else {
		tmp = 1.0 - t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = z * math.sin(y)
	tmp = 0
	if (x <= -1.2) or not (x <= 1.1):
		tmp = x - t_0
	else:
		tmp = 1.0 - t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(z * sin(y))
	tmp = 0.0
	if ((x <= -1.2) || !(x <= 1.1))
		tmp = Float64(x - t_0);
	else
		tmp = Float64(1.0 - t_0);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = z * sin(y);
	tmp = 0.0;
	if ((x <= -1.2) || ~((x <= 1.1)))
		tmp = x - t_0;
	else
		tmp = 1.0 - 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.2], N[Not[LessEqual[x, 1.1]], $MachinePrecision]], N[(x - t$95$0), $MachinePrecision], N[(1.0 - t$95$0), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := z \cdot \sin y\\
\mathbf{if}\;x \leq -1.2 \lor \neg \left(x \leq 1.1\right):\\
\;\;\;\;x - t\_0\\

\mathbf{else}:\\
\;\;\;\;1 - t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.19999999999999996 or 1.1000000000000001 < 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 98.4%

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

    if -1.19999999999999996 < x < 1.1000000000000001

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

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

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

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

      \[\leadsto \color{blue}{1 - z \cdot \sin y} \]
    7. Step-by-step derivation
      1. *-commutative71.5%

        \[\leadsto 1 - \color{blue}{\sin y \cdot z} \]
    8. Simplified71.5%

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

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

Alternative 6: 78.9% accurate, 1.8× speedup?

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

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

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

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


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

    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 \color{blue}{\left(1 + x\right)} - z \cdot \sin y \]
    4. Step-by-step derivation
      1. +-commutative99.9%

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

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

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

    if -5e13 < x < 6.00000000000000006e-23

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

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

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

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

      \[\leadsto \color{blue}{1 - z \cdot \sin y} \]
    7. Step-by-step derivation
      1. *-commutative72.2%

        \[\leadsto 1 - \color{blue}{\sin y \cdot z} \]
    8. Simplified72.2%

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

    if 6.00000000000000006e-23 < 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 97.1%

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

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

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

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

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

Alternative 7: 88.2% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \left(x + 1\right) - z \cdot \sin y \end{array} \]
(FPCore (x y z) :precision binary64 (- (+ x 1.0) (* z (sin y))))
double code(double x, double y, double z) {
	return (x + 1.0) - (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 + 1.0d0) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
	return (x + 1.0) - (z * Math.sin(y));
}
def code(x, y, z):
	return (x + 1.0) - (z * math.sin(y))
function code(x, y, z)
	return Float64(Float64(x + 1.0) - Float64(z * sin(y)))
end
function tmp = code(x, y, z)
	tmp = (x + 1.0) - (z * sin(y));
end
code[x_, y_, z_] := N[(N[(x + 1.0), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(x + 1\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. Taylor expanded in y around 0 86.5%

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

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

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

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

Alternative 8: 69.5% accurate, 9.8× speedup?

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

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

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


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

    1. Initial program 99.8%

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

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

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

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

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

    if -11800 < y < 0.589999999999999969

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

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

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

        \[\leadsto \left(1 + \left(x + \color{blue}{{y}^{2} \cdot -0.5}\right)\right) - y \cdot z \]
    6. Simplified99.5%

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

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

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

Alternative 9: 69.1% accurate, 12.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.3 \cdot 10^{-5} \lor \neg \left(y \leq 2.9 \cdot 10^{+104}\right):\\
\;\;\;\;x + 1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.3000000000000003e-5 or 2.8999999999999998e104 < 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 73.7%

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

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

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

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

    if -3.3000000000000003e-5 < y < 2.8999999999999998e104

    1. Initial program 99.9%

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

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

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

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

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

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

Alternative 10: 65.3% accurate, 13.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.6 \cdot 10^{+184} \lor \neg \left(z \leq 4.7 \cdot 10^{+142}\right):\\
\;\;\;\;x - y \cdot z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -5.5999999999999998e184 or 4.7e142 < 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 95.0%

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

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

    if -5.5999999999999998e184 < z < 4.7e142

    1. Initial program 99.9%

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

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

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

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

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

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

Alternative 11: 61.3% 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 86.5%

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

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

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

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

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

Alternative 12: 42.7% accurate, 207.0× speedup?

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

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

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

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

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

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

    \[\leadsto \color{blue}{x} \]
  7. Final simplification42.5%

    \[\leadsto x \]
  8. Add Preprocessing

Reproduce

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