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

Percentage Accurate: 99.9% → 99.9%
Time: 9.3s
Alternatives: 16
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 16 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--.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 74.1% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;t\_1 \leq -5000000:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;t\_1 \leq 0.986:\\
\;\;\;\;\cos y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < -5e128

    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. lower-+.f6470.2

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

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

    if -5e128 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < -5e6 or 0.98599999999999999 < (-.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. *-commutativeN/A

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

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

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

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

    if -5e6 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < 0.98599999999999999

    1. Initial program 99.9%

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

        \[\leadsto \color{blue}{\left(x + \cos y\right) - z \cdot \sin y} \]
      2. 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}} \]
      3. 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)}}} \]
      4. 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)}}} \]
      5. 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}}}} \]
      6. flip--N/A

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

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

        \[\leadsto \frac{1}{\color{blue}{{\left(\left(x + \cos y\right) - z \cdot \sin y\right)}^{-1}}} \]
      9. lower-pow.f6499.3

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

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

      \[\leadsto \color{blue}{x + \cos y} \]
    6. 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.f6498.9

        \[\leadsto \color{blue}{\cos y} + x \]
    7. Applied rewrites98.9%

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

      \[\leadsto \cos y \]
    9. Step-by-step derivation
      1. Applied rewrites96.6%

        \[\leadsto \cos y \]
    10. Recombined 3 regimes into one program.
    11. Add Preprocessing

    Alternative 3: 99.2% accurate, 1.0× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2.3 \cdot 10^{-10}:\\ \;\;\;\;\left(1 + x\right) - z \cdot \sin y\\ \mathbf{elif}\;x \leq 0.00062:\\ \;\;\;\;\mathsf{fma}\left(-z, \sin y, \cos y\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\sin y, -z, 1 + x\right)\\ \end{array} \end{array} \]
    (FPCore (x y z)
     :precision binary64
     (if (<= x -2.3e-10)
       (- (+ 1.0 x) (* z (sin y)))
       (if (<= x 0.00062)
         (fma (- z) (sin y) (cos y))
         (fma (sin y) (- z) (+ 1.0 x)))))
    double code(double x, double y, double z) {
    	double tmp;
    	if (x <= -2.3e-10) {
    		tmp = (1.0 + x) - (z * sin(y));
    	} else if (x <= 0.00062) {
    		tmp = fma(-z, sin(y), cos(y));
    	} else {
    		tmp = fma(sin(y), -z, (1.0 + x));
    	}
    	return tmp;
    }
    
    function code(x, y, z)
    	tmp = 0.0
    	if (x <= -2.3e-10)
    		tmp = Float64(Float64(1.0 + x) - Float64(z * sin(y)));
    	elseif (x <= 0.00062)
    		tmp = fma(Float64(-z), sin(y), cos(y));
    	else
    		tmp = fma(sin(y), Float64(-z), Float64(1.0 + x));
    	end
    	return tmp
    end
    
    code[x_, y_, z_] := If[LessEqual[x, -2.3e-10], N[(N[(1.0 + x), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.00062], N[((-z) * N[Sin[y], $MachinePrecision] + N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(N[Sin[y], $MachinePrecision] * (-z) + N[(1.0 + x), $MachinePrecision]), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;x \leq -2.3 \cdot 10^{-10}:\\
    \;\;\;\;\left(1 + x\right) - z \cdot \sin y\\
    
    \mathbf{elif}\;x \leq 0.00062:\\
    \;\;\;\;\mathsf{fma}\left(-z, \sin y, \cos y\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\mathsf{fma}\left(\sin y, -z, 1 + x\right)\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if x < -2.30000000000000007e-10

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

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

        if -2.30000000000000007e-10 < x < 6.2e-4

        1. Initial program 99.9%

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

          \[\leadsto \color{blue}{\cos y - z \cdot \sin y} \]
        4. Step-by-step derivation
          1. sub-negN/A

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\color{blue}{-z}, \sin y, \cos y\right) \]
          6. lower-sin.f64N/A

            \[\leadsto \mathsf{fma}\left(-z, \color{blue}{\sin y}, \cos y\right) \]
          7. lower-cos.f6499.4

            \[\leadsto \mathsf{fma}\left(-z, \sin y, \color{blue}{\cos y}\right) \]
        5. Applied rewrites99.4%

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

        if 6.2e-4 < 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

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

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

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

              \[\leadsto \left(x + 1\right) - \color{blue}{z \cdot \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(-z\right)} \cdot \sin y \]
            5. +-commutativeN/A

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

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

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

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

              \[\leadsto \mathsf{fma}\left(\sin y, -z, \color{blue}{1 + x}\right) \]
            10. lower-+.f6498.8

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

            \[\leadsto \color{blue}{\mathsf{fma}\left(\sin y, -z, 1 + x\right)} \]
        5. Recombined 3 regimes into one program.
        6. Final simplification99.3%

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

        Alternative 4: 99.9% accurate, 1.0× speedup?

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

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

        Alternative 5: 99.3% accurate, 1.7× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -600000000000:\\ \;\;\;\;\left(1 + x\right) - z \cdot \sin y\\ \mathbf{elif}\;z \leq 2.1:\\ \;\;\;\;x + \cos y\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\sin y, -z, 1 + x\right)\\ \end{array} \end{array} \]
        (FPCore (x y z)
         :precision binary64
         (if (<= z -600000000000.0)
           (- (+ 1.0 x) (* z (sin y)))
           (if (<= z 2.1) (+ x (cos y)) (fma (sin y) (- z) (+ 1.0 x)))))
        double code(double x, double y, double z) {
        	double tmp;
        	if (z <= -600000000000.0) {
        		tmp = (1.0 + x) - (z * sin(y));
        	} else if (z <= 2.1) {
        		tmp = x + cos(y);
        	} else {
        		tmp = fma(sin(y), -z, (1.0 + x));
        	}
        	return tmp;
        }
        
        function code(x, y, z)
        	tmp = 0.0
        	if (z <= -600000000000.0)
        		tmp = Float64(Float64(1.0 + x) - Float64(z * sin(y)));
        	elseif (z <= 2.1)
        		tmp = Float64(x + cos(y));
        	else
        		tmp = fma(sin(y), Float64(-z), Float64(1.0 + x));
        	end
        	return tmp
        end
        
        code[x_, y_, z_] := If[LessEqual[z, -600000000000.0], N[(N[(1.0 + x), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.1], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(N[Sin[y], $MachinePrecision] * (-z) + N[(1.0 + x), $MachinePrecision]), $MachinePrecision]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;z \leq -600000000000:\\
        \;\;\;\;\left(1 + x\right) - z \cdot \sin y\\
        
        \mathbf{elif}\;z \leq 2.1:\\
        \;\;\;\;x + \cos y\\
        
        \mathbf{else}:\\
        \;\;\;\;\mathsf{fma}\left(\sin y, -z, 1 + x\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if z < -6e11

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

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

            if -6e11 < z < 2.10000000000000009

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

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

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

            if 2.10000000000000009 < z

            1. Initial program 99.8%

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

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

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

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

                  \[\leadsto \left(x + 1\right) - \color{blue}{z \cdot \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(-z\right)} \cdot \sin y \]
                5. +-commutativeN/A

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

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

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

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

                  \[\leadsto \mathsf{fma}\left(\sin y, -z, \color{blue}{1 + x}\right) \]
                10. lower-+.f6498.2

                  \[\leadsto \mathsf{fma}\left(\sin y, -z, \color{blue}{1 + x}\right) \]
              3. Applied rewrites98.2%

                \[\leadsto \color{blue}{\mathsf{fma}\left(\sin y, -z, 1 + x\right)} \]
            5. Recombined 3 regimes into one program.
            6. Final simplification99.3%

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

            Alternative 6: 99.3% accurate, 1.7× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(1 + x\right) - z \cdot \sin y\\ \mathbf{if}\;z \leq -600000000000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 2.1:\\ \;\;\;\;x + \cos y\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
            (FPCore (x y z)
             :precision binary64
             (let* ((t_0 (- (+ 1.0 x) (* z (sin y)))))
               (if (<= z -600000000000.0) t_0 (if (<= z 2.1) (+ x (cos y)) t_0))))
            double code(double x, double y, double z) {
            	double t_0 = (1.0 + x) - (z * sin(y));
            	double tmp;
            	if (z <= -600000000000.0) {
            		tmp = t_0;
            	} else if (z <= 2.1) {
            		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 = (1.0d0 + x) - (z * sin(y))
                if (z <= (-600000000000.0d0)) then
                    tmp = t_0
                else if (z <= 2.1d0) 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 = (1.0 + x) - (z * Math.sin(y));
            	double tmp;
            	if (z <= -600000000000.0) {
            		tmp = t_0;
            	} else if (z <= 2.1) {
            		tmp = x + Math.cos(y);
            	} else {
            		tmp = t_0;
            	}
            	return tmp;
            }
            
            def code(x, y, z):
            	t_0 = (1.0 + x) - (z * math.sin(y))
            	tmp = 0
            	if z <= -600000000000.0:
            		tmp = t_0
            	elif z <= 2.1:
            		tmp = x + math.cos(y)
            	else:
            		tmp = t_0
            	return tmp
            
            function code(x, y, z)
            	t_0 = Float64(Float64(1.0 + x) - Float64(z * sin(y)))
            	tmp = 0.0
            	if (z <= -600000000000.0)
            		tmp = t_0;
            	elseif (z <= 2.1)
            		tmp = Float64(x + cos(y));
            	else
            		tmp = t_0;
            	end
            	return tmp
            end
            
            function tmp_2 = code(x, y, z)
            	t_0 = (1.0 + x) - (z * sin(y));
            	tmp = 0.0;
            	if (z <= -600000000000.0)
            		tmp = t_0;
            	elseif (z <= 2.1)
            		tmp = x + cos(y);
            	else
            		tmp = t_0;
            	end
            	tmp_2 = tmp;
            end
            
            code[x_, y_, z_] := Block[{t$95$0 = N[(N[(1.0 + x), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -600000000000.0], t$95$0, If[LessEqual[z, 2.1], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], t$95$0]]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            t_0 := \left(1 + x\right) - z \cdot \sin y\\
            \mathbf{if}\;z \leq -600000000000:\\
            \;\;\;\;t\_0\\
            
            \mathbf{elif}\;z \leq 2.1:\\
            \;\;\;\;x + \cos y\\
            
            \mathbf{else}:\\
            \;\;\;\;t\_0\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if z < -6e11 or 2.10000000000000009 < z

              1. Initial program 99.8%

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

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

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

                if -6e11 < z < 2.10000000000000009

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

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

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

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

              Alternative 7: 84.3% accurate, 1.8× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(-z, \sin y, 1\right)\\ \mathbf{if}\;z \leq -1.95 \cdot 10^{+19}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 1.32 \cdot 10^{+110}:\\ \;\;\;\;x + \cos y\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
              (FPCore (x y z)
               :precision binary64
               (let* ((t_0 (fma (- z) (sin y) 1.0)))
                 (if (<= z -1.95e+19) t_0 (if (<= z 1.32e+110) (+ x (cos y)) t_0))))
              double code(double x, double y, double z) {
              	double t_0 = fma(-z, sin(y), 1.0);
              	double tmp;
              	if (z <= -1.95e+19) {
              		tmp = t_0;
              	} else if (z <= 1.32e+110) {
              		tmp = x + cos(y);
              	} else {
              		tmp = t_0;
              	}
              	return tmp;
              }
              
              function code(x, y, z)
              	t_0 = fma(Float64(-z), sin(y), 1.0)
              	tmp = 0.0
              	if (z <= -1.95e+19)
              		tmp = t_0;
              	elseif (z <= 1.32e+110)
              		tmp = Float64(x + cos(y));
              	else
              		tmp = t_0;
              	end
              	return tmp
              end
              
              code[x_, y_, z_] := Block[{t$95$0 = N[((-z) * N[Sin[y], $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[z, -1.95e+19], t$95$0, If[LessEqual[z, 1.32e+110], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], t$95$0]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              t_0 := \mathsf{fma}\left(-z, \sin y, 1\right)\\
              \mathbf{if}\;z \leq -1.95 \cdot 10^{+19}:\\
              \;\;\;\;t\_0\\
              
              \mathbf{elif}\;z \leq 1.32 \cdot 10^{+110}:\\
              \;\;\;\;x + \cos y\\
              
              \mathbf{else}:\\
              \;\;\;\;t\_0\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if z < -1.95e19 or 1.32e110 < z

                1. Initial program 99.8%

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

                    \[\leadsto \color{blue}{\left(x + \cos y\right) - z \cdot \sin y} \]
                  2. 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}} \]
                  3. 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)}}} \]
                  4. 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)}}} \]
                  5. 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}}}} \]
                  6. flip--N/A

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

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

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

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

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

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

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

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

                    \[\leadsto \color{blue}{\mathsf{fma}\left(-1 \cdot z, \sin y, \cos y\right)} \]
                  4. mul-1-negN/A

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

                    \[\leadsto \mathsf{fma}\left(\color{blue}{-z}, \sin y, \cos y\right) \]
                  6. lower-sin.f64N/A

                    \[\leadsto \mathsf{fma}\left(-z, \color{blue}{\sin y}, \cos y\right) \]
                  7. lower-cos.f6473.0

                    \[\leadsto \mathsf{fma}\left(-z, \sin y, \color{blue}{\cos y}\right) \]
                7. Applied rewrites73.0%

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

                  \[\leadsto \mathsf{fma}\left(-z, \sin y, 1\right) \]
                9. Step-by-step derivation
                  1. Applied rewrites73.0%

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

                  if -1.95e19 < z < 1.32e110

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

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

                    \[\leadsto \color{blue}{\cos y + x} \]
                10. Recombined 2 regimes into one program.
                11. Final simplification85.6%

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

                Alternative 8: 80.2% accurate, 1.8× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(-z\right) \cdot \sin y\\ \mathbf{if}\;z \leq -1.95 \cdot 10^{+19}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 2.4 \cdot 10^{+110}:\\ \;\;\;\;x + \cos y\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                (FPCore (x y z)
                 :precision binary64
                 (let* ((t_0 (* (- z) (sin y))))
                   (if (<= z -1.95e+19) t_0 (if (<= z 2.4e+110) (+ x (cos y)) t_0))))
                double code(double x, double y, double z) {
                	double t_0 = -z * sin(y);
                	double tmp;
                	if (z <= -1.95e+19) {
                		tmp = t_0;
                	} else if (z <= 2.4e+110) {
                		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 = -z * sin(y)
                    if (z <= (-1.95d+19)) then
                        tmp = t_0
                    else if (z <= 2.4d+110) 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 = -z * Math.sin(y);
                	double tmp;
                	if (z <= -1.95e+19) {
                		tmp = t_0;
                	} else if (z <= 2.4e+110) {
                		tmp = x + Math.cos(y);
                	} else {
                		tmp = t_0;
                	}
                	return tmp;
                }
                
                def code(x, y, z):
                	t_0 = -z * math.sin(y)
                	tmp = 0
                	if z <= -1.95e+19:
                		tmp = t_0
                	elif z <= 2.4e+110:
                		tmp = x + math.cos(y)
                	else:
                		tmp = t_0
                	return tmp
                
                function code(x, y, z)
                	t_0 = Float64(Float64(-z) * sin(y))
                	tmp = 0.0
                	if (z <= -1.95e+19)
                		tmp = t_0;
                	elseif (z <= 2.4e+110)
                		tmp = Float64(x + cos(y));
                	else
                		tmp = t_0;
                	end
                	return tmp
                end
                
                function tmp_2 = code(x, y, z)
                	t_0 = -z * sin(y);
                	tmp = 0.0;
                	if (z <= -1.95e+19)
                		tmp = t_0;
                	elseif (z <= 2.4e+110)
                		tmp = x + cos(y);
                	else
                		tmp = t_0;
                	end
                	tmp_2 = tmp;
                end
                
                code[x_, y_, z_] := Block[{t$95$0 = N[((-z) * N[Sin[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.95e+19], t$95$0, If[LessEqual[z, 2.4e+110], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], t$95$0]]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                t_0 := \left(-z\right) \cdot \sin y\\
                \mathbf{if}\;z \leq -1.95 \cdot 10^{+19}:\\
                \;\;\;\;t\_0\\
                
                \mathbf{elif}\;z \leq 2.4 \cdot 10^{+110}:\\
                \;\;\;\;x + \cos y\\
                
                \mathbf{else}:\\
                \;\;\;\;t\_0\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if z < -1.95e19 or 2.40000000000000012e110 < 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. distribute-lft-neg-inN/A

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

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

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

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

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

                  if -1.95e19 < z < 2.40000000000000012e110

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

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

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

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

                Alternative 9: 82.0% accurate, 1.8× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} t_0 := x + \cos y\\ \mathbf{if}\;y \leq -30000000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 25500:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, y \cdot y, -1\right) \cdot z, y, 1 + x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                (FPCore (x y z)
                 :precision binary64
                 (let* ((t_0 (+ x (cos y))))
                   (if (<= y -30000000.0)
                     t_0
                     (if (<= y 25500.0)
                       (fma (* (fma 0.16666666666666666 (* y y) -1.0) z) y (+ 1.0 x))
                       t_0))))
                double code(double x, double y, double z) {
                	double t_0 = x + cos(y);
                	double tmp;
                	if (y <= -30000000.0) {
                		tmp = t_0;
                	} else if (y <= 25500.0) {
                		tmp = fma((fma(0.16666666666666666, (y * y), -1.0) * z), y, (1.0 + x));
                	} else {
                		tmp = t_0;
                	}
                	return tmp;
                }
                
                function code(x, y, z)
                	t_0 = Float64(x + cos(y))
                	tmp = 0.0
                	if (y <= -30000000.0)
                		tmp = t_0;
                	elseif (y <= 25500.0)
                		tmp = fma(Float64(fma(0.16666666666666666, Float64(y * y), -1.0) * z), y, Float64(1.0 + x));
                	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, -30000000.0], t$95$0, If[LessEqual[y, 25500.0], N[(N[(N[(0.16666666666666666 * N[(y * y), $MachinePrecision] + -1.0), $MachinePrecision] * z), $MachinePrecision] * y + N[(1.0 + x), $MachinePrecision]), $MachinePrecision], t$95$0]]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                t_0 := x + \cos y\\
                \mathbf{if}\;y \leq -30000000:\\
                \;\;\;\;t\_0\\
                
                \mathbf{elif}\;y \leq 25500:\\
                \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, y \cdot y, -1\right) \cdot z, y, 1 + x\right)\\
                
                \mathbf{else}:\\
                \;\;\;\;t\_0\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if y < -3e7 or 25500 < y

                  1. Initial program 99.8%

                    \[\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.f6458.7

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

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

                  if -3e7 < y < 25500

                  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. associate-+r+N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \mathsf{fma}\left(z \cdot \left(\frac{1}{6} \cdot {y}^{2} - 1\right), y, 1 + x\right) \]
                  7. Step-by-step derivation
                    1. Applied rewrites97.3%

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

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

                  Alternative 10: 70.8% accurate, 5.2× speedup?

                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -220000000:\\ \;\;\;\;1 + x\\ \mathbf{elif}\;y \leq 4.5 \cdot 10^{+14}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, z \cdot y, -0.5\right) \cdot y - z, y, 1 + x\right)\\ \mathbf{else}:\\ \;\;\;\;1 + x\\ \end{array} \end{array} \]
                  (FPCore (x y z)
                   :precision binary64
                   (if (<= y -220000000.0)
                     (+ 1.0 x)
                     (if (<= y 4.5e+14)
                       (fma (- (* (fma 0.16666666666666666 (* z y) -0.5) y) z) y (+ 1.0 x))
                       (+ 1.0 x))))
                  double code(double x, double y, double z) {
                  	double tmp;
                  	if (y <= -220000000.0) {
                  		tmp = 1.0 + x;
                  	} else if (y <= 4.5e+14) {
                  		tmp = fma(((fma(0.16666666666666666, (z * y), -0.5) * y) - z), y, (1.0 + x));
                  	} else {
                  		tmp = 1.0 + x;
                  	}
                  	return tmp;
                  }
                  
                  function code(x, y, z)
                  	tmp = 0.0
                  	if (y <= -220000000.0)
                  		tmp = Float64(1.0 + x);
                  	elseif (y <= 4.5e+14)
                  		tmp = fma(Float64(Float64(fma(0.16666666666666666, Float64(z * y), -0.5) * y) - z), y, Float64(1.0 + x));
                  	else
                  		tmp = Float64(1.0 + x);
                  	end
                  	return tmp
                  end
                  
                  code[x_, y_, z_] := If[LessEqual[y, -220000000.0], N[(1.0 + x), $MachinePrecision], If[LessEqual[y, 4.5e+14], N[(N[(N[(N[(0.16666666666666666 * N[(z * y), $MachinePrecision] + -0.5), $MachinePrecision] * y), $MachinePrecision] - z), $MachinePrecision] * y + N[(1.0 + x), $MachinePrecision]), $MachinePrecision], N[(1.0 + x), $MachinePrecision]]]
                  
                  \begin{array}{l}
                  
                  \\
                  \begin{array}{l}
                  \mathbf{if}\;y \leq -220000000:\\
                  \;\;\;\;1 + x\\
                  
                  \mathbf{elif}\;y \leq 4.5 \cdot 10^{+14}:\\
                  \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, z \cdot y, -0.5\right) \cdot y - z, y, 1 + x\right)\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;1 + x\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 2 regimes
                  2. if y < -2.2e8 or 4.5e14 < 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. lower-+.f6436.8

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

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

                    if -2.2e8 < y < 4.5e14

                    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. associate-+r+N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  Alternative 11: 70.7% accurate, 5.6× speedup?

                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -250000000:\\ \;\;\;\;1 + x\\ \mathbf{elif}\;y \leq 980000:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, y \cdot y, -1\right) \cdot z, y, 1 + x\right)\\ \mathbf{else}:\\ \;\;\;\;1 + x\\ \end{array} \end{array} \]
                  (FPCore (x y z)
                   :precision binary64
                   (if (<= y -250000000.0)
                     (+ 1.0 x)
                     (if (<= y 980000.0)
                       (fma (* (fma 0.16666666666666666 (* y y) -1.0) z) y (+ 1.0 x))
                       (+ 1.0 x))))
                  double code(double x, double y, double z) {
                  	double tmp;
                  	if (y <= -250000000.0) {
                  		tmp = 1.0 + x;
                  	} else if (y <= 980000.0) {
                  		tmp = fma((fma(0.16666666666666666, (y * y), -1.0) * z), y, (1.0 + x));
                  	} else {
                  		tmp = 1.0 + x;
                  	}
                  	return tmp;
                  }
                  
                  function code(x, y, z)
                  	tmp = 0.0
                  	if (y <= -250000000.0)
                  		tmp = Float64(1.0 + x);
                  	elseif (y <= 980000.0)
                  		tmp = fma(Float64(fma(0.16666666666666666, Float64(y * y), -1.0) * z), y, Float64(1.0 + x));
                  	else
                  		tmp = Float64(1.0 + x);
                  	end
                  	return tmp
                  end
                  
                  code[x_, y_, z_] := If[LessEqual[y, -250000000.0], N[(1.0 + x), $MachinePrecision], If[LessEqual[y, 980000.0], N[(N[(N[(0.16666666666666666 * N[(y * y), $MachinePrecision] + -1.0), $MachinePrecision] * z), $MachinePrecision] * y + N[(1.0 + x), $MachinePrecision]), $MachinePrecision], N[(1.0 + x), $MachinePrecision]]]
                  
                  \begin{array}{l}
                  
                  \\
                  \begin{array}{l}
                  \mathbf{if}\;y \leq -250000000:\\
                  \;\;\;\;1 + x\\
                  
                  \mathbf{elif}\;y \leq 980000:\\
                  \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, y \cdot y, -1\right) \cdot z, y, 1 + x\right)\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;1 + x\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 2 regimes
                  2. if y < -2.5e8 or 9.8e5 < 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. lower-+.f6436.5

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

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

                    if -2.5e8 < y < 9.8e5

                    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. associate-+r+N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto \mathsf{fma}\left(z \cdot \left(\frac{1}{6} \cdot {y}^{2} - 1\right), y, 1 + x\right) \]
                    7. Step-by-step derivation
                      1. Applied rewrites97.3%

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

                    Alternative 12: 70.6% accurate, 7.1× speedup?

                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -3.8 \cdot 10^{+29}:\\ \;\;\;\;1 + x\\ \mathbf{elif}\;y \leq 4.5 \cdot 10^{+15}:\\ \;\;\;\;\mathsf{fma}\left(-0.5 \cdot y - z, y, 1 + x\right)\\ \mathbf{else}:\\ \;\;\;\;1 + x\\ \end{array} \end{array} \]
                    (FPCore (x y z)
                     :precision binary64
                     (if (<= y -3.8e+29)
                       (+ 1.0 x)
                       (if (<= y 4.5e+15) (fma (- (* -0.5 y) z) y (+ 1.0 x)) (+ 1.0 x))))
                    double code(double x, double y, double z) {
                    	double tmp;
                    	if (y <= -3.8e+29) {
                    		tmp = 1.0 + x;
                    	} else if (y <= 4.5e+15) {
                    		tmp = fma(((-0.5 * y) - z), y, (1.0 + x));
                    	} else {
                    		tmp = 1.0 + x;
                    	}
                    	return tmp;
                    }
                    
                    function code(x, y, z)
                    	tmp = 0.0
                    	if (y <= -3.8e+29)
                    		tmp = Float64(1.0 + x);
                    	elseif (y <= 4.5e+15)
                    		tmp = fma(Float64(Float64(-0.5 * y) - z), y, Float64(1.0 + x));
                    	else
                    		tmp = Float64(1.0 + x);
                    	end
                    	return tmp
                    end
                    
                    code[x_, y_, z_] := If[LessEqual[y, -3.8e+29], N[(1.0 + x), $MachinePrecision], If[LessEqual[y, 4.5e+15], N[(N[(N[(-0.5 * y), $MachinePrecision] - z), $MachinePrecision] * y + N[(1.0 + x), $MachinePrecision]), $MachinePrecision], N[(1.0 + x), $MachinePrecision]]]
                    
                    \begin{array}{l}
                    
                    \\
                    \begin{array}{l}
                    \mathbf{if}\;y \leq -3.8 \cdot 10^{+29}:\\
                    \;\;\;\;1 + x\\
                    
                    \mathbf{elif}\;y \leq 4.5 \cdot 10^{+15}:\\
                    \;\;\;\;\mathsf{fma}\left(-0.5 \cdot y - z, y, 1 + x\right)\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;1 + x\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 2 regimes
                    2. if y < -3.79999999999999971e29 or 4.5e15 < 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. lower-+.f6437.4

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

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

                      if -3.79999999999999971e29 < y < 4.5e15

                      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(\frac{-1}{2} \cdot y - z\right)\right)} \]
                      4. Step-by-step derivation
                        1. associate-+r+N/A

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

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

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

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

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

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

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

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

                    Alternative 13: 70.5% accurate, 9.6× speedup?

                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -4.4 \cdot 10^{+55}:\\ \;\;\;\;1 + x\\ \mathbf{elif}\;y \leq 3.15:\\ \;\;\;\;x - \mathsf{fma}\left(z, y, -1\right)\\ \mathbf{else}:\\ \;\;\;\;1 + x\\ \end{array} \end{array} \]
                    (FPCore (x y z)
                     :precision binary64
                     (if (<= y -4.4e+55)
                       (+ 1.0 x)
                       (if (<= y 3.15) (- x (fma z y -1.0)) (+ 1.0 x))))
                    double code(double x, double y, double z) {
                    	double tmp;
                    	if (y <= -4.4e+55) {
                    		tmp = 1.0 + x;
                    	} else if (y <= 3.15) {
                    		tmp = x - fma(z, y, -1.0);
                    	} else {
                    		tmp = 1.0 + x;
                    	}
                    	return tmp;
                    }
                    
                    function code(x, y, z)
                    	tmp = 0.0
                    	if (y <= -4.4e+55)
                    		tmp = Float64(1.0 + x);
                    	elseif (y <= 3.15)
                    		tmp = Float64(x - fma(z, y, -1.0));
                    	else
                    		tmp = Float64(1.0 + x);
                    	end
                    	return tmp
                    end
                    
                    code[x_, y_, z_] := If[LessEqual[y, -4.4e+55], N[(1.0 + x), $MachinePrecision], If[LessEqual[y, 3.15], N[(x - N[(z * y + -1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 + x), $MachinePrecision]]]
                    
                    \begin{array}{l}
                    
                    \\
                    \begin{array}{l}
                    \mathbf{if}\;y \leq -4.4 \cdot 10^{+55}:\\
                    \;\;\;\;1 + x\\
                    
                    \mathbf{elif}\;y \leq 3.15:\\
                    \;\;\;\;x - \mathsf{fma}\left(z, y, -1\right)\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;1 + x\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 2 regimes
                    2. if y < -4.40000000000000021e55 or 3.14999999999999991 < 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. lower-+.f6437.5

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

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

                      if -4.40000000000000021e55 < y < 3.14999999999999991

                      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. *-commutativeN/A

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

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

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

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

                    Alternative 14: 67.4% accurate, 10.1× speedup?

                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -98000:\\ \;\;\;\;1 + x\\ \mathbf{elif}\;x \leq 4:\\ \;\;\;\;\mathsf{fma}\left(-y, z, 1\right)\\ \mathbf{else}:\\ \;\;\;\;1 + x\\ \end{array} \end{array} \]
                    (FPCore (x y z)
                     :precision binary64
                     (if (<= x -98000.0) (+ 1.0 x) (if (<= x 4.0) (fma (- y) z 1.0) (+ 1.0 x))))
                    double code(double x, double y, double z) {
                    	double tmp;
                    	if (x <= -98000.0) {
                    		tmp = 1.0 + x;
                    	} else if (x <= 4.0) {
                    		tmp = fma(-y, z, 1.0);
                    	} else {
                    		tmp = 1.0 + x;
                    	}
                    	return tmp;
                    }
                    
                    function code(x, y, z)
                    	tmp = 0.0
                    	if (x <= -98000.0)
                    		tmp = Float64(1.0 + x);
                    	elseif (x <= 4.0)
                    		tmp = fma(Float64(-y), z, 1.0);
                    	else
                    		tmp = Float64(1.0 + x);
                    	end
                    	return tmp
                    end
                    
                    code[x_, y_, z_] := If[LessEqual[x, -98000.0], N[(1.0 + x), $MachinePrecision], If[LessEqual[x, 4.0], N[((-y) * z + 1.0), $MachinePrecision], N[(1.0 + x), $MachinePrecision]]]
                    
                    \begin{array}{l}
                    
                    \\
                    \begin{array}{l}
                    \mathbf{if}\;x \leq -98000:\\
                    \;\;\;\;1 + x\\
                    
                    \mathbf{elif}\;x \leq 4:\\
                    \;\;\;\;\mathsf{fma}\left(-y, z, 1\right)\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;1 + x\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 2 regimes
                    2. if x < -98000 or 4 < 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

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

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

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

                      if -98000 < x < 4

                      1. Initial program 99.9%

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

                          \[\leadsto \color{blue}{\left(x + \cos y\right) - z \cdot \sin y} \]
                        2. 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}} \]
                        3. 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)}}} \]
                        4. 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)}}} \]
                        5. 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}}}} \]
                        6. flip--N/A

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

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

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

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

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

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

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

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

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

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

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

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

                          \[\leadsto \color{blue}{\frac{\cos y - z \cdot \sin y}{x}} \cdot x + x \]
                        8. sub-negN/A

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

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

                          \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\cos y + -1 \cdot \left(z \cdot \sin y\right)}{x}, x, x\right)} \]
                      7. Applied rewrites82.0%

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

                        \[\leadsto \color{blue}{1 + \left(x + -1 \cdot \left(y \cdot z\right)\right)} \]
                      9. 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. *-commutativeN/A

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

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

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

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

                        \[\leadsto 1 - \color{blue}{y \cdot z} \]
                      12. Step-by-step derivation
                        1. Applied rewrites47.6%

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

                      Alternative 15: 62.2% accurate, 53.0× speedup?

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

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

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

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

                      Alternative 16: 21.4% 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. lower-+.f6459.2

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

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

                        \[\leadsto 1 \]
                      7. Step-by-step derivation
                        1. Applied rewrites18.7%

                          \[\leadsto 1 \]
                        2. Add Preprocessing

                        Reproduce

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