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

Percentage Accurate: 99.9% → 99.9%
Time: 12.8s
Alternatives: 15
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 15 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} \\ \mathsf{fma}\left(\sin y, -z, x + \cos y\right) \end{array} \]
(FPCore (x y z) :precision binary64 (fma (sin y) (- z) (+ x (cos y))))
double code(double x, double y, double z) {
	return fma(sin(y), -z, (x + cos(y)));
}
function code(x, y, z)
	return fma(sin(y), Float64(-z), Float64(x + cos(y)))
end
code[x_, y_, z_] := N[(N[Sin[y], $MachinePrecision] * (-z) + N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(\sin y, -z, x + \cos y\right)
\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. lift-cos.f64N/A

      \[\leadsto \left(x + \color{blue}{\cos y}\right) - z \cdot \sin y \]
    2. lift-+.f64N/A

      \[\leadsto \color{blue}{\left(x + \cos y\right)} - z \cdot \sin y \]
    3. lift-sin.f64N/A

      \[\leadsto \left(x + \cos y\right) - z \cdot \color{blue}{\sin y} \]
    4. lift-*.f64N/A

      \[\leadsto \left(x + \cos y\right) - \color{blue}{z \cdot \sin y} \]
    5. sub-negN/A

      \[\leadsto \color{blue}{\left(x + \cos y\right) + \left(\mathsf{neg}\left(z \cdot \sin y\right)\right)} \]
    6. +-commutativeN/A

      \[\leadsto \color{blue}{\left(\mathsf{neg}\left(z \cdot \sin y\right)\right) + \left(x + \cos y\right)} \]
    7. lift-*.f64N/A

      \[\leadsto \left(\mathsf{neg}\left(\color{blue}{z \cdot \sin y}\right)\right) + \left(x + \cos y\right) \]
    8. *-commutativeN/A

      \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\sin y \cdot z}\right)\right) + \left(x + \cos y\right) \]
    9. distribute-rgt-neg-inN/A

      \[\leadsto \color{blue}{\sin y \cdot \left(\mathsf{neg}\left(z\right)\right)} + \left(x + \cos y\right) \]
    10. lower-fma.f64N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(\sin y, \mathsf{neg}\left(z\right), x + \cos y\right)} \]
    11. lower-neg.f6499.9

      \[\leadsto \mathsf{fma}\left(\sin y, \color{blue}{-z}, x + \cos y\right) \]
  4. Applied egg-rr99.9%

    \[\leadsto \color{blue}{\mathsf{fma}\left(\sin y, -z, x + \cos y\right)} \]
  5. Add Preprocessing

Alternative 2: 98.2% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x + \cos y\\ t_1 := \sin y \cdot z\\ t_2 := t\_0 - t\_1\\ t_3 := x - t\_1\\ \mathbf{if}\;t\_2 \leq -1 \cdot 10^{+23}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;t\_2 \leq 100000000:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_3\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (+ x (cos y)))
        (t_1 (* (sin y) z))
        (t_2 (- t_0 t_1))
        (t_3 (- x t_1)))
   (if (<= t_2 -1e+23) t_3 (if (<= t_2 100000000.0) t_0 t_3))))
double code(double x, double y, double z) {
	double t_0 = x + cos(y);
	double t_1 = sin(y) * z;
	double t_2 = t_0 - t_1;
	double t_3 = x - t_1;
	double tmp;
	if (t_2 <= -1e+23) {
		tmp = t_3;
	} else if (t_2 <= 100000000.0) {
		tmp = t_0;
	} else {
		tmp = t_3;
	}
	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) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_0 = x + cos(y)
    t_1 = sin(y) * z
    t_2 = t_0 - t_1
    t_3 = x - t_1
    if (t_2 <= (-1d+23)) then
        tmp = t_3
    else if (t_2 <= 100000000.0d0) then
        tmp = t_0
    else
        tmp = t_3
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = x + Math.cos(y);
	double t_1 = Math.sin(y) * z;
	double t_2 = t_0 - t_1;
	double t_3 = x - t_1;
	double tmp;
	if (t_2 <= -1e+23) {
		tmp = t_3;
	} else if (t_2 <= 100000000.0) {
		tmp = t_0;
	} else {
		tmp = t_3;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x + math.cos(y)
	t_1 = math.sin(y) * z
	t_2 = t_0 - t_1
	t_3 = x - t_1
	tmp = 0
	if t_2 <= -1e+23:
		tmp = t_3
	elif t_2 <= 100000000.0:
		tmp = t_0
	else:
		tmp = t_3
	return tmp
function code(x, y, z)
	t_0 = Float64(x + cos(y))
	t_1 = Float64(sin(y) * z)
	t_2 = Float64(t_0 - t_1)
	t_3 = Float64(x - t_1)
	tmp = 0.0
	if (t_2 <= -1e+23)
		tmp = t_3;
	elseif (t_2 <= 100000000.0)
		tmp = t_0;
	else
		tmp = t_3;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x + cos(y);
	t_1 = sin(y) * z;
	t_2 = t_0 - t_1;
	t_3 = x - t_1;
	tmp = 0.0;
	if (t_2 <= -1e+23)
		tmp = t_3;
	elseif (t_2 <= 100000000.0)
		tmp = t_0;
	else
		tmp = t_3;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 - t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(x - t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+23], t$95$3, If[LessEqual[t$95$2, 100000000.0], t$95$0, t$95$3]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x + \cos y\\
t_1 := \sin y \cdot z\\
t_2 := t\_0 - t\_1\\
t_3 := x - t\_1\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+23}:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;t\_2 \leq 100000000:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < -9.9999999999999992e22 or 1e8 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 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

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

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

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

      \[\leadsto \color{blue}{\left(x + 1\right)} - z \cdot \sin y \]
    6. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \color{blue}{\left(x + 1\right)} - z \cdot \sin y \]
      2. lift-sin.f64N/A

        \[\leadsto \left(x + 1\right) - z \cdot \color{blue}{\sin y} \]
      3. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(x + 1\right) + \left(\mathsf{neg}\left(z\right)\right) \cdot \sin y} \]
      4. lift-neg.f64N/A

        \[\leadsto \left(x + 1\right) + \color{blue}{\left(\mathsf{neg}\left(z\right)\right)} \cdot \sin y \]
      5. *-commutativeN/A

        \[\leadsto \left(x + 1\right) + \color{blue}{\sin y \cdot \left(\mathsf{neg}\left(z\right)\right)} \]
      6. +-commutativeN/A

        \[\leadsto \color{blue}{\sin y \cdot \left(\mathsf{neg}\left(z\right)\right) + \left(x + 1\right)} \]
      7. lower-fma.f6499.8

        \[\leadsto \color{blue}{\mathsf{fma}\left(\sin y, -z, x + 1\right)} \]
    7. Applied egg-rr99.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\sin y, -z, x + 1\right)} \]
    8. Taylor expanded in y around inf

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

        \[\leadsto \color{blue}{\left(x + -1 \cdot \left(z \cdot \sin y\right)\right) + 1} \]
      2. mul-1-negN/A

        \[\leadsto \left(x + \color{blue}{\left(\mathsf{neg}\left(z \cdot \sin y\right)\right)}\right) + 1 \]
      3. unsub-negN/A

        \[\leadsto \color{blue}{\left(x - z \cdot \sin y\right)} + 1 \]
      4. associate-+l-N/A

        \[\leadsto \color{blue}{x - \left(z \cdot \sin y - 1\right)} \]
      5. sub-negN/A

        \[\leadsto x - \color{blue}{\left(z \cdot \sin y + \left(\mathsf{neg}\left(1\right)\right)\right)} \]
      6. remove-double-negN/A

        \[\leadsto x - \left(\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(z \cdot \sin y\right)\right)\right)\right)} + \left(\mathsf{neg}\left(1\right)\right)\right) \]
      7. mul-1-negN/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(\color{blue}{-1 \cdot \left(z \cdot \sin y\right)}\right)\right) + \left(\mathsf{neg}\left(1\right)\right)\right) \]
      8. distribute-neg-inN/A

        \[\leadsto x - \color{blue}{\left(\mathsf{neg}\left(\left(-1 \cdot \left(z \cdot \sin y\right) + 1\right)\right)\right)} \]
      9. +-commutativeN/A

        \[\leadsto x - \left(\mathsf{neg}\left(\color{blue}{\left(1 + -1 \cdot \left(z \cdot \sin y\right)\right)}\right)\right) \]
      10. mul-1-negN/A

        \[\leadsto x - \color{blue}{-1 \cdot \left(1 + -1 \cdot \left(z \cdot \sin y\right)\right)} \]
      11. *-commutativeN/A

        \[\leadsto x - \color{blue}{\left(1 + -1 \cdot \left(z \cdot \sin y\right)\right) \cdot -1} \]
      12. /-rgt-identityN/A

        \[\leadsto x - \color{blue}{\frac{1 + -1 \cdot \left(z \cdot \sin y\right)}{1}} \cdot -1 \]
      13. metadata-evalN/A

        \[\leadsto x - \frac{1 + -1 \cdot \left(z \cdot \sin y\right)}{1} \cdot \color{blue}{\left(\mathsf{neg}\left(1\right)\right)} \]
      14. rgt-mult-inverseN/A

        \[\leadsto x - \frac{1 + -1 \cdot \left(z \cdot \sin y\right)}{1} \cdot \left(\mathsf{neg}\left(\color{blue}{x \cdot \frac{1}{x}}\right)\right) \]
      15. distribute-rgt-neg-outN/A

        \[\leadsto x - \frac{1 + -1 \cdot \left(z \cdot \sin y\right)}{1} \cdot \color{blue}{\left(x \cdot \left(\mathsf{neg}\left(\frac{1}{x}\right)\right)\right)} \]
      16. distribute-neg-frac2N/A

        \[\leadsto x - \frac{1 + -1 \cdot \left(z \cdot \sin y\right)}{1} \cdot \left(x \cdot \color{blue}{\frac{1}{\mathsf{neg}\left(x\right)}}\right) \]
      17. mul-1-negN/A

        \[\leadsto x - \frac{1 + -1 \cdot \left(z \cdot \sin y\right)}{1} \cdot \left(x \cdot \frac{1}{\color{blue}{-1 \cdot x}}\right) \]
      18. associate-*r/N/A

        \[\leadsto x - \frac{1 + -1 \cdot \left(z \cdot \sin y\right)}{1} \cdot \color{blue}{\frac{x \cdot 1}{-1 \cdot x}} \]
      19. *-rgt-identityN/A

        \[\leadsto x - \frac{1 + -1 \cdot \left(z \cdot \sin y\right)}{1} \cdot \frac{\color{blue}{x}}{-1 \cdot x} \]
      20. times-fracN/A

        \[\leadsto x - \color{blue}{\frac{\left(1 + -1 \cdot \left(z \cdot \sin y\right)\right) \cdot x}{1 \cdot \left(-1 \cdot x\right)}} \]
      21. *-lft-identityN/A

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

      \[\leadsto \color{blue}{x - \mathsf{fma}\left(z, \sin y, -1\right)} \]
    11. Taylor expanded in z around inf

      \[\leadsto x - \color{blue}{z \cdot \sin y} \]
    12. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto x - \color{blue}{z \cdot \sin y} \]
      2. lower-sin.f6499.8

        \[\leadsto x - z \cdot \color{blue}{\sin y} \]
    13. Simplified99.8%

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

    if -9.9999999999999992e22 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < 1e8

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{x + \cos y} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{\cos y + x} \]
      2. lower-+.f64N/A

        \[\leadsto \color{blue}{\cos y + x} \]
      3. lower-cos.f6499.2

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

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

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

Alternative 3: 72.3% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(x + \cos y\right) - \sin y \cdot z\\ t_1 := x - \mathsf{fma}\left(y, z, -1\right)\\ \mathbf{if}\;t\_0 \leq -1 \cdot 10^{+27}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_0 \leq 0.9999790455489881:\\ \;\;\;\;\cos y\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (- (+ x (cos y)) (* (sin y) z))) (t_1 (- x (fma y z -1.0))))
   (if (<= t_0 -1e+27) t_1 (if (<= t_0 0.9999790455489881) (cos y) t_1))))
double code(double x, double y, double z) {
	double t_0 = (x + cos(y)) - (sin(y) * z);
	double t_1 = x - fma(y, z, -1.0);
	double tmp;
	if (t_0 <= -1e+27) {
		tmp = t_1;
	} else if (t_0 <= 0.9999790455489881) {
		tmp = cos(y);
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z)
	t_0 = Float64(Float64(x + cos(y)) - Float64(sin(y) * z))
	t_1 = Float64(x - fma(y, z, -1.0))
	tmp = 0.0
	if (t_0 <= -1e+27)
		tmp = t_1;
	elseif (t_0 <= 0.9999790455489881)
		tmp = cos(y);
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x - N[(y * z + -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e+27], t$95$1, If[LessEqual[t$95$0, 0.9999790455489881], N[Cos[y], $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(x + \cos y\right) - \sin y \cdot z\\
t_1 := x - \mathsf{fma}\left(y, z, -1\right)\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+27}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_0 \leq 0.9999790455489881:\\
\;\;\;\;\cos y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < -1e27 or 0.99997904554898809 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 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

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

        \[\leadsto \color{blue}{\left(x + -1 \cdot \left(y \cdot z\right)\right) + 1} \]
      2. mul-1-negN/A

        \[\leadsto \left(x + \color{blue}{\left(\mathsf{neg}\left(y \cdot z\right)\right)}\right) + 1 \]
      3. unsub-negN/A

        \[\leadsto \color{blue}{\left(x - y \cdot z\right)} + 1 \]
      4. associate-+l-N/A

        \[\leadsto \color{blue}{x - \left(y \cdot z - 1\right)} \]
      5. lower--.f64N/A

        \[\leadsto \color{blue}{x - \left(y \cdot z - 1\right)} \]
      6. sub-negN/A

        \[\leadsto x - \color{blue}{\left(y \cdot z + \left(\mathsf{neg}\left(1\right)\right)\right)} \]
      7. metadata-evalN/A

        \[\leadsto x - \left(y \cdot z + \color{blue}{-1}\right) \]
      8. lower-fma.f6470.9

        \[\leadsto x - \color{blue}{\mathsf{fma}\left(y, z, -1\right)} \]
    5. Simplified70.9%

      \[\leadsto \color{blue}{x - \mathsf{fma}\left(y, z, -1\right)} \]

    if -1e27 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < 0.99997904554898809

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{x + \cos y} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{\cos y + x} \]
      2. lower-+.f64N/A

        \[\leadsto \color{blue}{\cos y + x} \]
      3. lower-cos.f6495.4

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

      \[\leadsto \color{blue}{\cos y + x} \]
    6. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\cos y} \]
    7. Step-by-step derivation
      1. lower-cos.f6489.7

        \[\leadsto \color{blue}{\cos y} \]
    8. Simplified89.7%

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

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

Alternative 4: 99.9% accurate, 1.0× speedup?

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

\\
\left(x + \cos y\right) - \sin y \cdot z
\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) - \sin y \cdot z \]
  4. Add Preprocessing

Alternative 5: 79.1% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -\sin y \cdot z\\ \mathbf{if}\;z \leq -8 \cdot 10^{+202}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 69000000000000:\\ \;\;\;\;x + \cos y\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (- (* (sin y) z))))
   (if (<= z -8e+202) t_0 (if (<= z 69000000000000.0) (+ x (cos y)) t_0))))
double code(double x, double y, double z) {
	double t_0 = -(sin(y) * z);
	double tmp;
	if (z <= -8e+202) {
		tmp = t_0;
	} else if (z <= 69000000000000.0) {
		tmp = x + cos(y);
	} 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 (z <= (-8d+202)) then
        tmp = t_0
    else if (z <= 69000000000000.0d0) then
        tmp = x + cos(y)
    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 (z <= -8e+202) {
		tmp = t_0;
	} else if (z <= 69000000000000.0) {
		tmp = x + Math.cos(y);
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = -(math.sin(y) * z)
	tmp = 0
	if z <= -8e+202:
		tmp = t_0
	elif z <= 69000000000000.0:
		tmp = x + math.cos(y)
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(-Float64(sin(y) * z))
	tmp = 0.0
	if (z <= -8e+202)
		tmp = t_0;
	elseif (z <= 69000000000000.0)
		tmp = Float64(x + cos(y));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = -(sin(y) * z);
	tmp = 0.0;
	if (z <= -8e+202)
		tmp = t_0;
	elseif (z <= 69000000000000.0)
		tmp = x + cos(y);
	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[z, -8e+202], t$95$0, If[LessEqual[z, 69000000000000.0], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := -\sin y \cdot z\\
\mathbf{if}\;z \leq -8 \cdot 10^{+202}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq 69000000000000:\\
\;\;\;\;x + \cos y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -7.9999999999999992e202 or 6.9e13 < 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

      \[\leadsto \color{blue}{-1 \cdot \left(z \cdot \sin y\right)} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \color{blue}{\mathsf{neg}\left(z \cdot \sin y\right)} \]
      2. lower-neg.f64N/A

        \[\leadsto \color{blue}{\mathsf{neg}\left(z \cdot \sin y\right)} \]
      3. lower-*.f64N/A

        \[\leadsto \mathsf{neg}\left(\color{blue}{z \cdot \sin y}\right) \]
      4. lower-sin.f6471.8

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

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

    if -7.9999999999999992e202 < z < 6.9e13

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{x + \cos y} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{\cos y + x} \]
      2. lower-+.f64N/A

        \[\leadsto \color{blue}{\cos y + x} \]
      3. lower-cos.f6489.4

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -8 \cdot 10^{+202}:\\ \;\;\;\;-\sin y \cdot z\\ \mathbf{elif}\;z \leq 69000000000000:\\ \;\;\;\;x + \cos y\\ \mathbf{else}:\\ \;\;\;\;-\sin y \cdot z\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 80.6% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x + \cos y\\ \mathbf{if}\;y \leq -38:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 1.95:\\ \;\;\;\;\left(x + 1\right) - y \cdot \mathsf{fma}\left(y \cdot y, \mathsf{fma}\left(z \cdot \left(y \cdot y\right), \mathsf{fma}\left(y \cdot y, -0.0001984126984126984, 0.008333333333333333\right), z \cdot -0.16666666666666666\right), z\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (+ x (cos y))))
   (if (<= y -38.0)
     t_0
     (if (<= y 1.95)
       (-
        (+ x 1.0)
        (*
         y
         (fma
          (* y y)
          (fma
           (* z (* y y))
           (fma (* y y) -0.0001984126984126984 0.008333333333333333)
           (* z -0.16666666666666666))
          z)))
       t_0))))
double code(double x, double y, double z) {
	double t_0 = x + cos(y);
	double tmp;
	if (y <= -38.0) {
		tmp = t_0;
	} else if (y <= 1.95) {
		tmp = (x + 1.0) - (y * fma((y * y), fma((z * (y * y)), fma((y * y), -0.0001984126984126984, 0.008333333333333333), (z * -0.16666666666666666)), z));
	} else {
		tmp = t_0;
	}
	return tmp;
}
function code(x, y, z)
	t_0 = Float64(x + cos(y))
	tmp = 0.0
	if (y <= -38.0)
		tmp = t_0;
	elseif (y <= 1.95)
		tmp = Float64(Float64(x + 1.0) - Float64(y * fma(Float64(y * y), fma(Float64(z * Float64(y * y)), fma(Float64(y * y), -0.0001984126984126984, 0.008333333333333333), Float64(z * -0.16666666666666666)), z)));
	else
		tmp = t_0;
	end
	return tmp
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -38.0], t$95$0, If[LessEqual[y, 1.95], N[(N[(x + 1.0), $MachinePrecision] - N[(y * N[(N[(y * y), $MachinePrecision] * N[(N[(z * N[(y * y), $MachinePrecision]), $MachinePrecision] * N[(N[(y * y), $MachinePrecision] * -0.0001984126984126984 + 0.008333333333333333), $MachinePrecision] + N[(z * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x + \cos y\\
\mathbf{if}\;y \leq -38:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y \leq 1.95:\\
\;\;\;\;\left(x + 1\right) - y \cdot \mathsf{fma}\left(y \cdot y, \mathsf{fma}\left(z \cdot \left(y \cdot y\right), \mathsf{fma}\left(y \cdot y, -0.0001984126984126984, 0.008333333333333333\right), z \cdot -0.16666666666666666\right), z\right)\\

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


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

      \[\leadsto \color{blue}{x + \cos y} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{\cos y + x} \]
      2. lower-+.f64N/A

        \[\leadsto \color{blue}{\cos y + x} \]
      3. lower-cos.f6455.7

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

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

    if -38 < y < 1.94999999999999996

    1. Initial program 100.0%

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

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

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

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

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

      \[\leadsto \left(x + 1\right) - \color{blue}{y \cdot \left(z + {y}^{2} \cdot \left(\frac{-1}{6} \cdot z + {y}^{2} \cdot \left(\frac{-1}{5040} \cdot \left({y}^{2} \cdot z\right) + \frac{1}{120} \cdot z\right)\right)\right)} \]
    7. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \left(x + 1\right) - \color{blue}{y \cdot \left(z + {y}^{2} \cdot \left(\frac{-1}{6} \cdot z + {y}^{2} \cdot \left(\frac{-1}{5040} \cdot \left({y}^{2} \cdot z\right) + \frac{1}{120} \cdot z\right)\right)\right)} \]
      2. +-commutativeN/A

        \[\leadsto \left(x + 1\right) - y \cdot \color{blue}{\left({y}^{2} \cdot \left(\frac{-1}{6} \cdot z + {y}^{2} \cdot \left(\frac{-1}{5040} \cdot \left({y}^{2} \cdot z\right) + \frac{1}{120} \cdot z\right)\right) + z\right)} \]
      3. lower-fma.f64N/A

        \[\leadsto \left(x + 1\right) - y \cdot \color{blue}{\mathsf{fma}\left({y}^{2}, \frac{-1}{6} \cdot z + {y}^{2} \cdot \left(\frac{-1}{5040} \cdot \left({y}^{2} \cdot z\right) + \frac{1}{120} \cdot z\right), z\right)} \]
    8. Simplified98.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -38:\\ \;\;\;\;x + \cos y\\ \mathbf{elif}\;y \leq 1.95:\\ \;\;\;\;\left(x + 1\right) - y \cdot \mathsf{fma}\left(y \cdot y, \mathsf{fma}\left(z \cdot \left(y \cdot y\right), \mathsf{fma}\left(y \cdot y, -0.0001984126984126984, 0.008333333333333333\right), z \cdot -0.16666666666666666\right), z\right)\\ \mathbf{else}:\\ \;\;\;\;x + \cos y\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 68.4% accurate, 3.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -5.4 \cdot 10^{+22}:\\ \;\;\;\;x + 1\\ \mathbf{elif}\;y \leq 1.6 \cdot 10^{+78}:\\ \;\;\;\;\left(x + 1\right) - y \cdot \mathsf{fma}\left(y \cdot y, \mathsf{fma}\left(z \cdot \left(y \cdot y\right), \mathsf{fma}\left(y \cdot y, -0.0001984126984126984, 0.008333333333333333\right), z \cdot -0.16666666666666666\right), z\right)\\ \mathbf{else}:\\ \;\;\;\;x + 1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y -5.4e+22)
   (+ x 1.0)
   (if (<= y 1.6e+78)
     (-
      (+ x 1.0)
      (*
       y
       (fma
        (* y y)
        (fma
         (* z (* y y))
         (fma (* y y) -0.0001984126984126984 0.008333333333333333)
         (* z -0.16666666666666666))
        z)))
     (+ x 1.0))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -5.4e+22) {
		tmp = x + 1.0;
	} else if (y <= 1.6e+78) {
		tmp = (x + 1.0) - (y * fma((y * y), fma((z * (y * y)), fma((y * y), -0.0001984126984126984, 0.008333333333333333), (z * -0.16666666666666666)), z));
	} else {
		tmp = x + 1.0;
	}
	return tmp;
}
function code(x, y, z)
	tmp = 0.0
	if (y <= -5.4e+22)
		tmp = Float64(x + 1.0);
	elseif (y <= 1.6e+78)
		tmp = Float64(Float64(x + 1.0) - Float64(y * fma(Float64(y * y), fma(Float64(z * Float64(y * y)), fma(Float64(y * y), -0.0001984126984126984, 0.008333333333333333), Float64(z * -0.16666666666666666)), z)));
	else
		tmp = Float64(x + 1.0);
	end
	return tmp
end
code[x_, y_, z_] := If[LessEqual[y, -5.4e+22], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 1.6e+78], N[(N[(x + 1.0), $MachinePrecision] - N[(y * N[(N[(y * y), $MachinePrecision] * N[(N[(z * N[(y * y), $MachinePrecision]), $MachinePrecision] * N[(N[(y * y), $MachinePrecision] * -0.0001984126984126984 + 0.008333333333333333), $MachinePrecision] + N[(z * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq 1.6 \cdot 10^{+78}:\\
\;\;\;\;\left(x + 1\right) - y \cdot \mathsf{fma}\left(y \cdot y, \mathsf{fma}\left(z \cdot \left(y \cdot y\right), \mathsf{fma}\left(y \cdot y, -0.0001984126984126984, 0.008333333333333333\right), z \cdot -0.16666666666666666\right), z\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -5.4000000000000004e22 or 1.59999999999999997e78 < 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

      \[\leadsto \color{blue}{1 + x} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{x + 1} \]
      2. lower-+.f6431.8

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

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

    if -5.4000000000000004e22 < y < 1.59999999999999997e78

    1. Initial program 100.0%

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

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

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

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

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

      \[\leadsto \left(x + 1\right) - \color{blue}{y \cdot \left(z + {y}^{2} \cdot \left(\frac{-1}{6} \cdot z + {y}^{2} \cdot \left(\frac{-1}{5040} \cdot \left({y}^{2} \cdot z\right) + \frac{1}{120} \cdot z\right)\right)\right)} \]
    7. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \left(x + 1\right) - \color{blue}{y \cdot \left(z + {y}^{2} \cdot \left(\frac{-1}{6} \cdot z + {y}^{2} \cdot \left(\frac{-1}{5040} \cdot \left({y}^{2} \cdot z\right) + \frac{1}{120} \cdot z\right)\right)\right)} \]
      2. +-commutativeN/A

        \[\leadsto \left(x + 1\right) - y \cdot \color{blue}{\left({y}^{2} \cdot \left(\frac{-1}{6} \cdot z + {y}^{2} \cdot \left(\frac{-1}{5040} \cdot \left({y}^{2} \cdot z\right) + \frac{1}{120} \cdot z\right)\right) + z\right)} \]
      3. lower-fma.f64N/A

        \[\leadsto \left(x + 1\right) - y \cdot \color{blue}{\mathsf{fma}\left({y}^{2}, \frac{-1}{6} \cdot z + {y}^{2} \cdot \left(\frac{-1}{5040} \cdot \left({y}^{2} \cdot z\right) + \frac{1}{120} \cdot z\right), z\right)} \]
    8. Simplified90.0%

      \[\leadsto \left(x + 1\right) - \color{blue}{y \cdot \mathsf{fma}\left(y \cdot y, \mathsf{fma}\left(z \cdot \left(y \cdot y\right), \mathsf{fma}\left(y \cdot y, -0.0001984126984126984, 0.008333333333333333\right), z \cdot -0.16666666666666666\right), z\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 8: 68.3% accurate, 3.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -5.4 \cdot 10^{+22}:\\ \;\;\;\;x + 1\\ \mathbf{elif}\;y \leq 1.6 \cdot 10^{+78}:\\ \;\;\;\;x - \mathsf{fma}\left(z, \mathsf{fma}\left(\mathsf{fma}\left(y, y \cdot \mathsf{fma}\left(y \cdot y, -0.0001984126984126984, 0.008333333333333333\right), -0.16666666666666666\right), y \cdot \left(y \cdot y\right), y\right), -1\right)\\ \mathbf{else}:\\ \;\;\;\;x + 1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y -5.4e+22)
   (+ x 1.0)
   (if (<= y 1.6e+78)
     (-
      x
      (fma
       z
       (fma
        (fma
         y
         (* y (fma (* y y) -0.0001984126984126984 0.008333333333333333))
         -0.16666666666666666)
        (* y (* y y))
        y)
       -1.0))
     (+ x 1.0))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -5.4e+22) {
		tmp = x + 1.0;
	} else if (y <= 1.6e+78) {
		tmp = x - fma(z, fma(fma(y, (y * fma((y * y), -0.0001984126984126984, 0.008333333333333333)), -0.16666666666666666), (y * (y * y)), y), -1.0);
	} else {
		tmp = x + 1.0;
	}
	return tmp;
}
function code(x, y, z)
	tmp = 0.0
	if (y <= -5.4e+22)
		tmp = Float64(x + 1.0);
	elseif (y <= 1.6e+78)
		tmp = Float64(x - fma(z, fma(fma(y, Float64(y * fma(Float64(y * y), -0.0001984126984126984, 0.008333333333333333)), -0.16666666666666666), Float64(y * Float64(y * y)), y), -1.0));
	else
		tmp = Float64(x + 1.0);
	end
	return tmp
end
code[x_, y_, z_] := If[LessEqual[y, -5.4e+22], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 1.6e+78], N[(x - N[(z * N[(N[(y * N[(y * N[(N[(y * y), $MachinePrecision] * -0.0001984126984126984 + 0.008333333333333333), $MachinePrecision]), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] * N[(y * N[(y * y), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq 1.6 \cdot 10^{+78}:\\
\;\;\;\;x - \mathsf{fma}\left(z, \mathsf{fma}\left(\mathsf{fma}\left(y, y \cdot \mathsf{fma}\left(y \cdot y, -0.0001984126984126984, 0.008333333333333333\right), -0.16666666666666666\right), y \cdot \left(y \cdot y\right), y\right), -1\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -5.4000000000000004e22 or 1.59999999999999997e78 < 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

      \[\leadsto \color{blue}{1 + x} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{x + 1} \]
      2. lower-+.f6431.8

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

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

    if -5.4000000000000004e22 < y < 1.59999999999999997e78

    1. Initial program 100.0%

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

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

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

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

      \[\leadsto \color{blue}{\left(x + 1\right)} - z \cdot \sin y \]
    6. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \color{blue}{\left(x + 1\right)} - z \cdot \sin y \]
      2. lift-sin.f64N/A

        \[\leadsto \left(x + 1\right) - z \cdot \color{blue}{\sin y} \]
      3. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(x + 1\right) + \left(\mathsf{neg}\left(z\right)\right) \cdot \sin y} \]
      4. lift-neg.f64N/A

        \[\leadsto \left(x + 1\right) + \color{blue}{\left(\mathsf{neg}\left(z\right)\right)} \cdot \sin y \]
      5. *-commutativeN/A

        \[\leadsto \left(x + 1\right) + \color{blue}{\sin y \cdot \left(\mathsf{neg}\left(z\right)\right)} \]
      6. +-commutativeN/A

        \[\leadsto \color{blue}{\sin y \cdot \left(\mathsf{neg}\left(z\right)\right) + \left(x + 1\right)} \]
      7. lower-fma.f6496.5

        \[\leadsto \color{blue}{\mathsf{fma}\left(\sin y, -z, x + 1\right)} \]
    7. Applied egg-rr96.5%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\sin y, -z, x + 1\right)} \]
    8. Taylor expanded in y around inf

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

        \[\leadsto \color{blue}{\left(x + -1 \cdot \left(z \cdot \sin y\right)\right) + 1} \]
      2. mul-1-negN/A

        \[\leadsto \left(x + \color{blue}{\left(\mathsf{neg}\left(z \cdot \sin y\right)\right)}\right) + 1 \]
      3. unsub-negN/A

        \[\leadsto \color{blue}{\left(x - z \cdot \sin y\right)} + 1 \]
      4. associate-+l-N/A

        \[\leadsto \color{blue}{x - \left(z \cdot \sin y - 1\right)} \]
      5. sub-negN/A

        \[\leadsto x - \color{blue}{\left(z \cdot \sin y + \left(\mathsf{neg}\left(1\right)\right)\right)} \]
      6. remove-double-negN/A

        \[\leadsto x - \left(\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(z \cdot \sin y\right)\right)\right)\right)} + \left(\mathsf{neg}\left(1\right)\right)\right) \]
      7. mul-1-negN/A

        \[\leadsto x - \left(\left(\mathsf{neg}\left(\color{blue}{-1 \cdot \left(z \cdot \sin y\right)}\right)\right) + \left(\mathsf{neg}\left(1\right)\right)\right) \]
      8. distribute-neg-inN/A

        \[\leadsto x - \color{blue}{\left(\mathsf{neg}\left(\left(-1 \cdot \left(z \cdot \sin y\right) + 1\right)\right)\right)} \]
      9. +-commutativeN/A

        \[\leadsto x - \left(\mathsf{neg}\left(\color{blue}{\left(1 + -1 \cdot \left(z \cdot \sin y\right)\right)}\right)\right) \]
      10. mul-1-negN/A

        \[\leadsto x - \color{blue}{-1 \cdot \left(1 + -1 \cdot \left(z \cdot \sin y\right)\right)} \]
      11. *-commutativeN/A

        \[\leadsto x - \color{blue}{\left(1 + -1 \cdot \left(z \cdot \sin y\right)\right) \cdot -1} \]
      12. /-rgt-identityN/A

        \[\leadsto x - \color{blue}{\frac{1 + -1 \cdot \left(z \cdot \sin y\right)}{1}} \cdot -1 \]
      13. metadata-evalN/A

        \[\leadsto x - \frac{1 + -1 \cdot \left(z \cdot \sin y\right)}{1} \cdot \color{blue}{\left(\mathsf{neg}\left(1\right)\right)} \]
      14. rgt-mult-inverseN/A

        \[\leadsto x - \frac{1 + -1 \cdot \left(z \cdot \sin y\right)}{1} \cdot \left(\mathsf{neg}\left(\color{blue}{x \cdot \frac{1}{x}}\right)\right) \]
      15. distribute-rgt-neg-outN/A

        \[\leadsto x - \frac{1 + -1 \cdot \left(z \cdot \sin y\right)}{1} \cdot \color{blue}{\left(x \cdot \left(\mathsf{neg}\left(\frac{1}{x}\right)\right)\right)} \]
      16. distribute-neg-frac2N/A

        \[\leadsto x - \frac{1 + -1 \cdot \left(z \cdot \sin y\right)}{1} \cdot \left(x \cdot \color{blue}{\frac{1}{\mathsf{neg}\left(x\right)}}\right) \]
      17. mul-1-negN/A

        \[\leadsto x - \frac{1 + -1 \cdot \left(z \cdot \sin y\right)}{1} \cdot \left(x \cdot \frac{1}{\color{blue}{-1 \cdot x}}\right) \]
      18. associate-*r/N/A

        \[\leadsto x - \frac{1 + -1 \cdot \left(z \cdot \sin y\right)}{1} \cdot \color{blue}{\frac{x \cdot 1}{-1 \cdot x}} \]
      19. *-rgt-identityN/A

        \[\leadsto x - \frac{1 + -1 \cdot \left(z \cdot \sin y\right)}{1} \cdot \frac{\color{blue}{x}}{-1 \cdot x} \]
      20. times-fracN/A

        \[\leadsto x - \color{blue}{\frac{\left(1 + -1 \cdot \left(z \cdot \sin y\right)\right) \cdot x}{1 \cdot \left(-1 \cdot x\right)}} \]
      21. *-lft-identityN/A

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

      \[\leadsto \color{blue}{x - \mathsf{fma}\left(z, \sin y, -1\right)} \]
    11. Taylor expanded in y around 0

      \[\leadsto x - \mathsf{fma}\left(z, \color{blue}{y \cdot \left(1 + {y}^{2} \cdot \left({y}^{2} \cdot \left(\frac{1}{120} + \frac{-1}{5040} \cdot {y}^{2}\right) - \frac{1}{6}\right)\right)}, -1\right) \]
    12. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto x - \mathsf{fma}\left(z, y \cdot \color{blue}{\left({y}^{2} \cdot \left({y}^{2} \cdot \left(\frac{1}{120} + \frac{-1}{5040} \cdot {y}^{2}\right) - \frac{1}{6}\right) + 1\right)}, -1\right) \]
      2. distribute-lft-inN/A

        \[\leadsto x - \mathsf{fma}\left(z, \color{blue}{y \cdot \left({y}^{2} \cdot \left({y}^{2} \cdot \left(\frac{1}{120} + \frac{-1}{5040} \cdot {y}^{2}\right) - \frac{1}{6}\right)\right) + y \cdot 1}, -1\right) \]
      3. associate-*r*N/A

        \[\leadsto x - \mathsf{fma}\left(z, \color{blue}{\left(y \cdot {y}^{2}\right) \cdot \left({y}^{2} \cdot \left(\frac{1}{120} + \frac{-1}{5040} \cdot {y}^{2}\right) - \frac{1}{6}\right)} + y \cdot 1, -1\right) \]
      4. *-commutativeN/A

        \[\leadsto x - \mathsf{fma}\left(z, \color{blue}{\left({y}^{2} \cdot \left(\frac{1}{120} + \frac{-1}{5040} \cdot {y}^{2}\right) - \frac{1}{6}\right) \cdot \left(y \cdot {y}^{2}\right)} + y \cdot 1, -1\right) \]
      5. *-rgt-identityN/A

        \[\leadsto x - \mathsf{fma}\left(z, \left({y}^{2} \cdot \left(\frac{1}{120} + \frac{-1}{5040} \cdot {y}^{2}\right) - \frac{1}{6}\right) \cdot \left(y \cdot {y}^{2}\right) + \color{blue}{y}, -1\right) \]
      6. lower-fma.f64N/A

        \[\leadsto x - \mathsf{fma}\left(z, \color{blue}{\mathsf{fma}\left({y}^{2} \cdot \left(\frac{1}{120} + \frac{-1}{5040} \cdot {y}^{2}\right) - \frac{1}{6}, y \cdot {y}^{2}, y\right)}, -1\right) \]
    13. Simplified90.0%

      \[\leadsto x - \mathsf{fma}\left(z, \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(y, y \cdot \mathsf{fma}\left(y \cdot y, -0.0001984126984126984, 0.008333333333333333\right), -0.16666666666666666\right), y \cdot \left(y \cdot y\right), y\right)}, -1\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 9: 69.3% accurate, 4.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -2.3 \cdot 10^{+25}:\\ \;\;\;\;x + 1\\ \mathbf{elif}\;y \leq 4.2 \cdot 10^{+42}:\\ \;\;\;\;\left(x + 1\right) - y \cdot \mathsf{fma}\left(z \cdot \left(y \cdot y\right), \mathsf{fma}\left(y, y \cdot 0.008333333333333333, -0.16666666666666666\right), z\right)\\ \mathbf{else}:\\ \;\;\;\;x + 1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y -2.3e+25)
   (+ x 1.0)
   (if (<= y 4.2e+42)
     (-
      (+ x 1.0)
      (*
       y
       (fma
        (* z (* y y))
        (fma y (* y 0.008333333333333333) -0.16666666666666666)
        z)))
     (+ x 1.0))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -2.3e+25) {
		tmp = x + 1.0;
	} else if (y <= 4.2e+42) {
		tmp = (x + 1.0) - (y * fma((z * (y * y)), fma(y, (y * 0.008333333333333333), -0.16666666666666666), z));
	} else {
		tmp = x + 1.0;
	}
	return tmp;
}
function code(x, y, z)
	tmp = 0.0
	if (y <= -2.3e+25)
		tmp = Float64(x + 1.0);
	elseif (y <= 4.2e+42)
		tmp = Float64(Float64(x + 1.0) - Float64(y * fma(Float64(z * Float64(y * y)), fma(y, Float64(y * 0.008333333333333333), -0.16666666666666666), z)));
	else
		tmp = Float64(x + 1.0);
	end
	return tmp
end
code[x_, y_, z_] := If[LessEqual[y, -2.3e+25], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 4.2e+42], N[(N[(x + 1.0), $MachinePrecision] - N[(y * N[(N[(z * N[(y * y), $MachinePrecision]), $MachinePrecision] * N[(y * N[(y * 0.008333333333333333), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq 4.2 \cdot 10^{+42}:\\
\;\;\;\;\left(x + 1\right) - y \cdot \mathsf{fma}\left(z \cdot \left(y \cdot y\right), \mathsf{fma}\left(y, y \cdot 0.008333333333333333, -0.16666666666666666\right), z\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.2999999999999998e25 or 4.19999999999999991e42 < 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

      \[\leadsto \color{blue}{1 + x} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{x + 1} \]
      2. lower-+.f6431.5

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

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

    if -2.2999999999999998e25 < y < 4.19999999999999991e42

    1. Initial program 100.0%

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

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

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

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

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

      \[\leadsto \left(x + 1\right) - \color{blue}{y \cdot \left(z + {y}^{2} \cdot \left(\frac{-1}{6} \cdot z + \frac{1}{120} \cdot \left({y}^{2} \cdot z\right)\right)\right)} \]
    7. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \left(x + 1\right) - \color{blue}{y \cdot \left(z + {y}^{2} \cdot \left(\frac{-1}{6} \cdot z + \frac{1}{120} \cdot \left({y}^{2} \cdot z\right)\right)\right)} \]
      2. +-commutativeN/A

        \[\leadsto \left(x + 1\right) - y \cdot \color{blue}{\left({y}^{2} \cdot \left(\frac{-1}{6} \cdot z + \frac{1}{120} \cdot \left({y}^{2} \cdot z\right)\right) + z\right)} \]
      3. distribute-lft-inN/A

        \[\leadsto \left(x + 1\right) - y \cdot \left(\color{blue}{\left({y}^{2} \cdot \left(\frac{-1}{6} \cdot z\right) + {y}^{2} \cdot \left(\frac{1}{120} \cdot \left({y}^{2} \cdot z\right)\right)\right)} + z\right) \]
      4. *-commutativeN/A

        \[\leadsto \left(x + 1\right) - y \cdot \left(\left({y}^{2} \cdot \color{blue}{\left(z \cdot \frac{-1}{6}\right)} + {y}^{2} \cdot \left(\frac{1}{120} \cdot \left({y}^{2} \cdot z\right)\right)\right) + z\right) \]
      5. associate-*r*N/A

        \[\leadsto \left(x + 1\right) - y \cdot \left(\left(\color{blue}{\left({y}^{2} \cdot z\right) \cdot \frac{-1}{6}} + {y}^{2} \cdot \left(\frac{1}{120} \cdot \left({y}^{2} \cdot z\right)\right)\right) + z\right) \]
      6. *-commutativeN/A

        \[\leadsto \left(x + 1\right) - y \cdot \left(\left(\color{blue}{\frac{-1}{6} \cdot \left({y}^{2} \cdot z\right)} + {y}^{2} \cdot \left(\frac{1}{120} \cdot \left({y}^{2} \cdot z\right)\right)\right) + z\right) \]
      7. associate-*r*N/A

        \[\leadsto \left(x + 1\right) - y \cdot \left(\left(\frac{-1}{6} \cdot \left({y}^{2} \cdot z\right) + \color{blue}{\left({y}^{2} \cdot \frac{1}{120}\right) \cdot \left({y}^{2} \cdot z\right)}\right) + z\right) \]
      8. *-commutativeN/A

        \[\leadsto \left(x + 1\right) - y \cdot \left(\left(\frac{-1}{6} \cdot \left({y}^{2} \cdot z\right) + \color{blue}{\left(\frac{1}{120} \cdot {y}^{2}\right)} \cdot \left({y}^{2} \cdot z\right)\right) + z\right) \]
      9. distribute-rgt-outN/A

        \[\leadsto \left(x + 1\right) - y \cdot \left(\color{blue}{\left({y}^{2} \cdot z\right) \cdot \left(\frac{-1}{6} + \frac{1}{120} \cdot {y}^{2}\right)} + z\right) \]
      10. +-commutativeN/A

        \[\leadsto \left(x + 1\right) - y \cdot \left(\left({y}^{2} \cdot z\right) \cdot \color{blue}{\left(\frac{1}{120} \cdot {y}^{2} + \frac{-1}{6}\right)} + z\right) \]
      11. metadata-evalN/A

        \[\leadsto \left(x + 1\right) - y \cdot \left(\left({y}^{2} \cdot z\right) \cdot \left(\frac{1}{120} \cdot {y}^{2} + \color{blue}{\left(\mathsf{neg}\left(\frac{1}{6}\right)\right)}\right) + z\right) \]
      12. sub-negN/A

        \[\leadsto \left(x + 1\right) - y \cdot \left(\left({y}^{2} \cdot z\right) \cdot \color{blue}{\left(\frac{1}{120} \cdot {y}^{2} - \frac{1}{6}\right)} + z\right) \]
      13. lower-fma.f64N/A

        \[\leadsto \left(x + 1\right) - y \cdot \color{blue}{\mathsf{fma}\left({y}^{2} \cdot z, \frac{1}{120} \cdot {y}^{2} - \frac{1}{6}, z\right)} \]
    8. Simplified90.5%

      \[\leadsto \left(x + 1\right) - \color{blue}{y \cdot \mathsf{fma}\left(z \cdot \left(y \cdot y\right), \mathsf{fma}\left(y, y \cdot 0.008333333333333333, -0.16666666666666666\right), z\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 10: 69.6% accurate, 5.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -5.5 \cdot 10^{+22}:\\ \;\;\;\;x + 1\\ \mathbf{elif}\;y \leq 5.4:\\ \;\;\;\;1 + \mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(y, z \cdot 0.16666666666666666, -0.5\right), -z\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;x + 1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y -5.5e+22)
   (+ x 1.0)
   (if (<= y 5.4)
     (+ 1.0 (fma y (fma y (fma y (* z 0.16666666666666666) -0.5) (- z)) x))
     (+ x 1.0))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -5.5e+22) {
		tmp = x + 1.0;
	} else if (y <= 5.4) {
		tmp = 1.0 + fma(y, fma(y, fma(y, (z * 0.16666666666666666), -0.5), -z), x);
	} else {
		tmp = x + 1.0;
	}
	return tmp;
}
function code(x, y, z)
	tmp = 0.0
	if (y <= -5.5e+22)
		tmp = Float64(x + 1.0);
	elseif (y <= 5.4)
		tmp = Float64(1.0 + fma(y, fma(y, fma(y, Float64(z * 0.16666666666666666), -0.5), Float64(-z)), x));
	else
		tmp = Float64(x + 1.0);
	end
	return tmp
end
code[x_, y_, z_] := If[LessEqual[y, -5.5e+22], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 5.4], N[(1.0 + N[(y * N[(y * N[(y * N[(z * 0.16666666666666666), $MachinePrecision] + -0.5), $MachinePrecision] + (-z)), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq 5.4:\\
\;\;\;\;1 + \mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(y, z \cdot 0.16666666666666666, -0.5\right), -z\right), x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -5.50000000000000021e22 or 5.4000000000000004 < 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

      \[\leadsto \color{blue}{1 + x} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{x + 1} \]
      2. lower-+.f6430.6

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

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

    if -5.50000000000000021e22 < y < 5.4000000000000004

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{1 + \left(x + y \cdot \left(y \cdot \left(\frac{1}{6} \cdot \left(y \cdot z\right) - \frac{1}{2}\right) - z\right)\right)} \]
    4. Step-by-step derivation
      1. lower-+.f64N/A

        \[\leadsto \color{blue}{1 + \left(x + y \cdot \left(y \cdot \left(\frac{1}{6} \cdot \left(y \cdot z\right) - \frac{1}{2}\right) - z\right)\right)} \]
      2. +-commutativeN/A

        \[\leadsto 1 + \color{blue}{\left(y \cdot \left(y \cdot \left(\frac{1}{6} \cdot \left(y \cdot z\right) - \frac{1}{2}\right) - z\right) + x\right)} \]
      3. lower-fma.f64N/A

        \[\leadsto 1 + \color{blue}{\mathsf{fma}\left(y, y \cdot \left(\frac{1}{6} \cdot \left(y \cdot z\right) - \frac{1}{2}\right) - z, x\right)} \]
      4. sub-negN/A

        \[\leadsto 1 + \mathsf{fma}\left(y, \color{blue}{y \cdot \left(\frac{1}{6} \cdot \left(y \cdot z\right) - \frac{1}{2}\right) + \left(\mathsf{neg}\left(z\right)\right)}, x\right) \]
      5. lower-fma.f64N/A

        \[\leadsto 1 + \mathsf{fma}\left(y, \color{blue}{\mathsf{fma}\left(y, \frac{1}{6} \cdot \left(y \cdot z\right) - \frac{1}{2}, \mathsf{neg}\left(z\right)\right)}, x\right) \]
      6. sub-negN/A

        \[\leadsto 1 + \mathsf{fma}\left(y, \mathsf{fma}\left(y, \color{blue}{\frac{1}{6} \cdot \left(y \cdot z\right) + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}, \mathsf{neg}\left(z\right)\right), x\right) \]
      7. associate-*r*N/A

        \[\leadsto 1 + \mathsf{fma}\left(y, \mathsf{fma}\left(y, \color{blue}{\left(\frac{1}{6} \cdot y\right) \cdot z} + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right), \mathsf{neg}\left(z\right)\right), x\right) \]
      8. *-commutativeN/A

        \[\leadsto 1 + \mathsf{fma}\left(y, \mathsf{fma}\left(y, \color{blue}{\left(y \cdot \frac{1}{6}\right)} \cdot z + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right), \mathsf{neg}\left(z\right)\right), x\right) \]
      9. associate-*l*N/A

        \[\leadsto 1 + \mathsf{fma}\left(y, \mathsf{fma}\left(y, \color{blue}{y \cdot \left(\frac{1}{6} \cdot z\right)} + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right), \mathsf{neg}\left(z\right)\right), x\right) \]
      10. metadata-evalN/A

        \[\leadsto 1 + \mathsf{fma}\left(y, \mathsf{fma}\left(y, y \cdot \left(\frac{1}{6} \cdot z\right) + \color{blue}{\frac{-1}{2}}, \mathsf{neg}\left(z\right)\right), x\right) \]
      11. lower-fma.f64N/A

        \[\leadsto 1 + \mathsf{fma}\left(y, \mathsf{fma}\left(y, \color{blue}{\mathsf{fma}\left(y, \frac{1}{6} \cdot z, \frac{-1}{2}\right)}, \mathsf{neg}\left(z\right)\right), x\right) \]
      12. *-commutativeN/A

        \[\leadsto 1 + \mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(y, \color{blue}{z \cdot \frac{1}{6}}, \frac{-1}{2}\right), \mathsf{neg}\left(z\right)\right), x\right) \]
      13. lower-*.f64N/A

        \[\leadsto 1 + \mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(y, \color{blue}{z \cdot \frac{1}{6}}, \frac{-1}{2}\right), \mathsf{neg}\left(z\right)\right), x\right) \]
      14. lower-neg.f6496.0

        \[\leadsto 1 + \mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(y, z \cdot 0.16666666666666666, -0.5\right), \color{blue}{-z}\right), x\right) \]
    5. Simplified96.0%

      \[\leadsto \color{blue}{1 + \mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(y, z \cdot 0.16666666666666666, -0.5\right), -z\right), x\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 11: 69.1% accurate, 5.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -5.5 \cdot 10^{+22}:\\ \;\;\;\;x + 1\\ \mathbf{elif}\;y \leq 1.6 \cdot 10^{+78}:\\ \;\;\;\;1 + \mathsf{fma}\left(y \cdot z, \mathsf{fma}\left(0.16666666666666666, y \cdot y, -1\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;x + 1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y -5.5e+22)
   (+ x 1.0)
   (if (<= y 1.6e+78)
     (+ 1.0 (fma (* y z) (fma 0.16666666666666666 (* y y) -1.0) x))
     (+ x 1.0))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -5.5e+22) {
		tmp = x + 1.0;
	} else if (y <= 1.6e+78) {
		tmp = 1.0 + fma((y * z), fma(0.16666666666666666, (y * y), -1.0), x);
	} else {
		tmp = x + 1.0;
	}
	return tmp;
}
function code(x, y, z)
	tmp = 0.0
	if (y <= -5.5e+22)
		tmp = Float64(x + 1.0);
	elseif (y <= 1.6e+78)
		tmp = Float64(1.0 + fma(Float64(y * z), fma(0.16666666666666666, Float64(y * y), -1.0), x));
	else
		tmp = Float64(x + 1.0);
	end
	return tmp
end
code[x_, y_, z_] := If[LessEqual[y, -5.5e+22], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 1.6e+78], N[(1.0 + N[(N[(y * z), $MachinePrecision] * N[(0.16666666666666666 * N[(y * y), $MachinePrecision] + -1.0), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq 1.6 \cdot 10^{+78}:\\
\;\;\;\;1 + \mathsf{fma}\left(y \cdot z, \mathsf{fma}\left(0.16666666666666666, y \cdot y, -1\right), x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -5.50000000000000021e22 or 1.59999999999999997e78 < 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

      \[\leadsto \color{blue}{1 + x} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{x + 1} \]
      2. lower-+.f6431.8

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

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

    if -5.50000000000000021e22 < y < 1.59999999999999997e78

    1. Initial program 100.0%

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

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

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

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

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

      \[\leadsto \color{blue}{1 + \left(x + y \cdot \left(\frac{1}{6} \cdot \left({y}^{2} \cdot z\right) - z\right)\right)} \]
    7. Step-by-step derivation
      1. lower-+.f64N/A

        \[\leadsto \color{blue}{1 + \left(x + y \cdot \left(\frac{1}{6} \cdot \left({y}^{2} \cdot z\right) - z\right)\right)} \]
      2. +-commutativeN/A

        \[\leadsto 1 + \color{blue}{\left(y \cdot \left(\frac{1}{6} \cdot \left({y}^{2} \cdot z\right) - z\right) + x\right)} \]
      3. associate-*r*N/A

        \[\leadsto 1 + \left(y \cdot \left(\color{blue}{\left(\frac{1}{6} \cdot {y}^{2}\right) \cdot z} - z\right) + x\right) \]
      4. *-lft-identityN/A

        \[\leadsto 1 + \left(y \cdot \left(\left(\frac{1}{6} \cdot {y}^{2}\right) \cdot z - \color{blue}{1 \cdot z}\right) + x\right) \]
      5. distribute-rgt-out--N/A

        \[\leadsto 1 + \left(y \cdot \color{blue}{\left(z \cdot \left(\frac{1}{6} \cdot {y}^{2} - 1\right)\right)} + x\right) \]
      6. associate-*r*N/A

        \[\leadsto 1 + \left(\color{blue}{\left(y \cdot z\right) \cdot \left(\frac{1}{6} \cdot {y}^{2} - 1\right)} + x\right) \]
      7. lower-fma.f64N/A

        \[\leadsto 1 + \color{blue}{\mathsf{fma}\left(y \cdot z, \frac{1}{6} \cdot {y}^{2} - 1, x\right)} \]
      8. lower-*.f64N/A

        \[\leadsto 1 + \mathsf{fma}\left(\color{blue}{y \cdot z}, \frac{1}{6} \cdot {y}^{2} - 1, x\right) \]
      9. sub-negN/A

        \[\leadsto 1 + \mathsf{fma}\left(y \cdot z, \color{blue}{\frac{1}{6} \cdot {y}^{2} + \left(\mathsf{neg}\left(1\right)\right)}, x\right) \]
      10. metadata-evalN/A

        \[\leadsto 1 + \mathsf{fma}\left(y \cdot z, \frac{1}{6} \cdot {y}^{2} + \color{blue}{-1}, x\right) \]
      11. lower-fma.f64N/A

        \[\leadsto 1 + \mathsf{fma}\left(y \cdot z, \color{blue}{\mathsf{fma}\left(\frac{1}{6}, {y}^{2}, -1\right)}, x\right) \]
      12. unpow2N/A

        \[\leadsto 1 + \mathsf{fma}\left(y \cdot z, \mathsf{fma}\left(\frac{1}{6}, \color{blue}{y \cdot y}, -1\right), x\right) \]
      13. lower-*.f6489.7

        \[\leadsto 1 + \mathsf{fma}\left(y \cdot z, \mathsf{fma}\left(0.16666666666666666, \color{blue}{y \cdot y}, -1\right), x\right) \]
    8. Simplified89.7%

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

Alternative 12: 69.4% accurate, 9.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -3.5 \cdot 10^{+57}:\\ \;\;\;\;x + 1\\ \mathbf{elif}\;y \leq 7.2 \cdot 10^{+43}:\\ \;\;\;\;x - \mathsf{fma}\left(y, z, -1\right)\\ \mathbf{else}:\\ \;\;\;\;x + 1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y -3.5e+57)
   (+ x 1.0)
   (if (<= y 7.2e+43) (- x (fma y z -1.0)) (+ x 1.0))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -3.5e+57) {
		tmp = x + 1.0;
	} else if (y <= 7.2e+43) {
		tmp = x - fma(y, z, -1.0);
	} else {
		tmp = x + 1.0;
	}
	return tmp;
}
function code(x, y, z)
	tmp = 0.0
	if (y <= -3.5e+57)
		tmp = Float64(x + 1.0);
	elseif (y <= 7.2e+43)
		tmp = Float64(x - fma(y, z, -1.0));
	else
		tmp = Float64(x + 1.0);
	end
	return tmp
end
code[x_, y_, z_] := If[LessEqual[y, -3.5e+57], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 7.2e+43], N[(x - N[(y * z + -1.0), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq 7.2 \cdot 10^{+43}:\\
\;\;\;\;x - \mathsf{fma}\left(y, z, -1\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.4999999999999997e57 or 7.2000000000000002e43 < 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

      \[\leadsto \color{blue}{1 + x} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{x + 1} \]
      2. lower-+.f6430.0

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

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

    if -3.4999999999999997e57 < y < 7.2000000000000002e43

    1. Initial program 100.0%

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

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

        \[\leadsto \color{blue}{\left(x + -1 \cdot \left(y \cdot z\right)\right) + 1} \]
      2. mul-1-negN/A

        \[\leadsto \left(x + \color{blue}{\left(\mathsf{neg}\left(y \cdot z\right)\right)}\right) + 1 \]
      3. unsub-negN/A

        \[\leadsto \color{blue}{\left(x - y \cdot z\right)} + 1 \]
      4. associate-+l-N/A

        \[\leadsto \color{blue}{x - \left(y \cdot z - 1\right)} \]
      5. lower--.f64N/A

        \[\leadsto \color{blue}{x - \left(y \cdot z - 1\right)} \]
      6. sub-negN/A

        \[\leadsto x - \color{blue}{\left(y \cdot z + \left(\mathsf{neg}\left(1\right)\right)\right)} \]
      7. metadata-evalN/A

        \[\leadsto x - \left(y \cdot z + \color{blue}{-1}\right) \]
      8. lower-fma.f6488.6

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

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

Alternative 13: 62.5% accurate, 10.6× speedup?

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

\\
\begin{array}{l}
t_0 := y \cdot \left(-z\right)\\
\mathbf{if}\;z \leq -9.5 \cdot 10^{+203}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq 3.4 \cdot 10^{+258}:\\
\;\;\;\;x + 1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -9.4999999999999995e203 or 3.39999999999999981e258 < z

    1. Initial program 99.9%

      \[\left(x + \cos y\right) - z \cdot \sin y \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-cos.f64N/A

        \[\leadsto \left(x + \color{blue}{\cos y}\right) - z \cdot \sin y \]
      2. lift-+.f64N/A

        \[\leadsto \color{blue}{\left(x + \cos y\right)} - z \cdot \sin y \]
      3. lift-sin.f64N/A

        \[\leadsto \left(x + \cos y\right) - z \cdot \color{blue}{\sin y} \]
      4. lift-*.f64N/A

        \[\leadsto \left(x + \cos y\right) - \color{blue}{z \cdot \sin y} \]
      5. flip--N/A

        \[\leadsto \color{blue}{\frac{\left(x + \cos y\right) \cdot \left(x + \cos y\right) - \left(z \cdot \sin y\right) \cdot \left(z \cdot \sin y\right)}{\left(x + \cos y\right) + z \cdot \sin y}} \]
      6. clear-numN/A

        \[\leadsto \color{blue}{\frac{1}{\frac{\left(x + \cos y\right) + z \cdot \sin y}{\left(x + \cos y\right) \cdot \left(x + \cos y\right) - \left(z \cdot \sin y\right) \cdot \left(z \cdot \sin y\right)}}} \]
      7. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{1}{\frac{\left(x + \cos y\right) + z \cdot \sin y}{\left(x + \cos y\right) \cdot \left(x + \cos y\right) - \left(z \cdot \sin y\right) \cdot \left(z \cdot \sin y\right)}}} \]
      8. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{1}{\frac{\left(x + \cos y\right) \cdot \left(x + \cos y\right) - \left(z \cdot \sin y\right) \cdot \left(z \cdot \sin y\right)}{\left(x + \cos y\right) + z \cdot \sin y}}}} \]
      9. flip--N/A

        \[\leadsto \frac{1}{\frac{1}{\color{blue}{\left(x + \cos y\right) - z \cdot \sin y}}} \]
      10. lift--.f64N/A

        \[\leadsto \frac{1}{\frac{1}{\color{blue}{\left(x + \cos y\right) - z \cdot \sin y}}} \]
      11. lower-/.f6499.6

        \[\leadsto \frac{1}{\color{blue}{\frac{1}{\left(x + \cos y\right) - z \cdot \sin y}}} \]
      12. lift--.f64N/A

        \[\leadsto \frac{1}{\frac{1}{\color{blue}{\left(x + \cos y\right) - z \cdot \sin y}}} \]
      13. lift-+.f64N/A

        \[\leadsto \frac{1}{\frac{1}{\color{blue}{\left(x + \cos y\right)} - z \cdot \sin y}} \]
      14. associate--l+N/A

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

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

      \[\leadsto \frac{1}{\color{blue}{\frac{-1}{z \cdot \sin y}}} \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{1}{\color{blue}{\frac{-1}{z \cdot \sin y}}} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{1}{\frac{-1}{\color{blue}{z \cdot \sin y}}} \]
      3. lower-sin.f6486.5

        \[\leadsto \frac{1}{\frac{-1}{z \cdot \color{blue}{\sin y}}} \]
    7. Simplified86.5%

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

      \[\leadsto \color{blue}{-1 \cdot \left(y \cdot z\right)} \]
    9. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \color{blue}{\mathsf{neg}\left(y \cdot z\right)} \]
      2. distribute-rgt-neg-inN/A

        \[\leadsto \color{blue}{y \cdot \left(\mathsf{neg}\left(z\right)\right)} \]
      3. mul-1-negN/A

        \[\leadsto y \cdot \color{blue}{\left(-1 \cdot z\right)} \]
      4. lower-*.f64N/A

        \[\leadsto \color{blue}{y \cdot \left(-1 \cdot z\right)} \]
      5. mul-1-negN/A

        \[\leadsto y \cdot \color{blue}{\left(\mathsf{neg}\left(z\right)\right)} \]
      6. lower-neg.f6439.0

        \[\leadsto y \cdot \color{blue}{\left(-z\right)} \]
    10. Simplified39.0%

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

    if -9.4999999999999995e203 < z < 3.39999999999999981e258

    1. Initial program 99.9%

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

      \[\leadsto \color{blue}{1 + x} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{x + 1} \]
      2. lower-+.f6465.8

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

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

Alternative 14: 61.4% accurate, 53.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

    \[\leadsto \color{blue}{1 + x} \]
  4. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \color{blue}{x + 1} \]
    2. lower-+.f6456.9

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

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

Alternative 15: 21.1% accurate, 212.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 y around 0

    \[\leadsto \color{blue}{1 + x} \]
  4. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \color{blue}{x + 1} \]
    2. lower-+.f6456.9

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

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

    \[\leadsto \color{blue}{1} \]
  7. Step-by-step derivation
    1. Simplified23.1%

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

    Reproduce

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