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

Percentage Accurate: 99.9% → 99.9%
Time: 7.2s
Alternatives: 14
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 14 alternatives:

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

Initial Program: 99.9% accurate, 1.0× speedup?

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

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

Alternative 1: 99.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(\cos y, z, x + \sin y\right) \end{array} \]
(FPCore (x y z) :precision binary64 (fma (cos y) z (+ x (sin y))))
double code(double x, double y, double z) {
	return fma(cos(y), z, (x + sin(y)));
}
function code(x, y, z)
	return fma(cos(y), z, Float64(x + sin(y)))
end
code[x_, y_, z_] := N[(N[Cos[y], $MachinePrecision] * z + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(\cos y, z, x + \sin y\right)
\end{array}
Derivation
  1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 80.3% accurate, 0.2× speedup?

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

\\
\begin{array}{l}
t_0 := z \cdot \cos y + \left(x + \sin y\right)\\
\mathbf{if}\;t\_0 \leq -500000000000:\\
\;\;\;\;x + z\\

\mathbf{elif}\;t\_0 \leq -0.2:\\
\;\;\;\;\sin y\\

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

\mathbf{elif}\;t\_0 \leq 1:\\
\;\;\;\;\sin y\\

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


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

    1. Initial program 99.9%

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

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

        \[\leadsto \color{blue}{z + x} \]
      2. lower-+.f6475.4

        \[\leadsto \color{blue}{z + x} \]
    5. Applied rewrites75.4%

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

    if -5e11 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < -0.20000000000000001 or 0.029999999999999999 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 1

    1. Initial program 100.0%

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

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

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

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

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

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

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

        \[\leadsto \sin y \]

      if -0.20000000000000001 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 0.029999999999999999

      1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, y, -0.5 \cdot z\right), y, 1\right), y, z + x\right)} \]
    8. Recombined 3 regimes into one program.
    9. Final simplification80.7%

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

    Alternative 3: 94.4% accurate, 1.0× speedup?

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

      1. Initial program 99.9%

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

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

          \[\leadsto \color{blue}{z + x} \]
        2. lower-+.f6482.4

          \[\leadsto \color{blue}{z + x} \]
      5. Applied rewrites82.4%

        \[\leadsto \color{blue}{z + x} \]
      6. Taylor expanded in x around -inf

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{z \cdot \cos y}{x}, x, x\right) \]
      10. Step-by-step derivation
        1. Applied rewrites96.9%

          \[\leadsto \mathsf{fma}\left(\frac{\cos y \cdot z}{x}, x, x\right) \]

        if -1.2499999999999999e-25 < x < 6.59999999999999992e-74

        1. Initial program 99.9%

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

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

            \[\leadsto \color{blue}{z \cdot \cos y + \sin y} \]
          2. *-commutativeN/A

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

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

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

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

          \[\leadsto \color{blue}{\mathsf{fma}\left(\cos y, z, \sin y\right)} \]
      11. Recombined 2 regimes into one program.
      12. Final simplification95.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.25 \cdot 10^{-25}:\\ \;\;\;\;\mathsf{fma}\left(\frac{z \cdot \cos y}{x}, x, x\right)\\ \mathbf{elif}\;x \leq 6.6 \cdot 10^{-74}:\\ \;\;\;\;\mathsf{fma}\left(\cos y, z, \sin y\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{z \cdot \cos y}{x}, x, x\right)\\ \end{array} \]
      13. Add Preprocessing

      Alternative 4: 89.1% accurate, 1.4× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \cos y\\ t_1 := \mathsf{fma}\left(\frac{t\_0}{x}, x, x\right)\\ \mathbf{if}\;z \leq -1.22 \cdot 10^{+145}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -1000000000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 8 \cdot 10^{-11}:\\ \;\;\;\;x + \sin y\\ \mathbf{elif}\;z \leq 5.4 \cdot 10^{+186}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_0 + \left(x + y\right)\\ \end{array} \end{array} \]
      (FPCore (x y z)
       :precision binary64
       (let* ((t_0 (* z (cos y))) (t_1 (fma (/ t_0 x) x x)))
         (if (<= z -1.22e+145)
           t_0
           (if (<= z -1000000000.0)
             t_1
             (if (<= z 8e-11)
               (+ x (sin y))
               (if (<= z 5.4e+186) t_1 (+ t_0 (+ x y))))))))
      double code(double x, double y, double z) {
      	double t_0 = z * cos(y);
      	double t_1 = fma((t_0 / x), x, x);
      	double tmp;
      	if (z <= -1.22e+145) {
      		tmp = t_0;
      	} else if (z <= -1000000000.0) {
      		tmp = t_1;
      	} else if (z <= 8e-11) {
      		tmp = x + sin(y);
      	} else if (z <= 5.4e+186) {
      		tmp = t_1;
      	} else {
      		tmp = t_0 + (x + y);
      	}
      	return tmp;
      }
      
      function code(x, y, z)
      	t_0 = Float64(z * cos(y))
      	t_1 = fma(Float64(t_0 / x), x, x)
      	tmp = 0.0
      	if (z <= -1.22e+145)
      		tmp = t_0;
      	elseif (z <= -1000000000.0)
      		tmp = t_1;
      	elseif (z <= 8e-11)
      		tmp = Float64(x + sin(y));
      	elseif (z <= 5.4e+186)
      		tmp = t_1;
      	else
      		tmp = Float64(t_0 + Float64(x + y));
      	end
      	return tmp
      end
      
      code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 / x), $MachinePrecision] * x + x), $MachinePrecision]}, If[LessEqual[z, -1.22e+145], t$95$0, If[LessEqual[z, -1000000000.0], t$95$1, If[LessEqual[z, 8e-11], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.4e+186], t$95$1, N[(t$95$0 + N[(x + y), $MachinePrecision]), $MachinePrecision]]]]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := z \cdot \cos y\\
      t_1 := \mathsf{fma}\left(\frac{t\_0}{x}, x, x\right)\\
      \mathbf{if}\;z \leq -1.22 \cdot 10^{+145}:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;z \leq -1000000000:\\
      \;\;\;\;t\_1\\
      
      \mathbf{elif}\;z \leq 8 \cdot 10^{-11}:\\
      \;\;\;\;x + \sin y\\
      
      \mathbf{elif}\;z \leq 5.4 \cdot 10^{+186}:\\
      \;\;\;\;t\_1\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_0 + \left(x + y\right)\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 4 regimes
      2. if z < -1.21999999999999994e145

        1. Initial program 99.8%

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

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

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

            \[\leadsto \color{blue}{\cos y \cdot z} \]
          3. lower-cos.f6496.4

            \[\leadsto \color{blue}{\cos y} \cdot z \]
        5. Applied rewrites96.4%

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

        if -1.21999999999999994e145 < z < -1e9 or 7.99999999999999952e-11 < z < 5.3999999999999998e186

        1. Initial program 99.9%

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

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

            \[\leadsto \color{blue}{z + x} \]
          2. lower-+.f6477.8

            \[\leadsto \color{blue}{z + x} \]
        5. Applied rewrites77.8%

          \[\leadsto \color{blue}{z + x} \]
        6. Taylor expanded in x around -inf

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\sin y + z \cdot \cos y}{x}, x, x\right)} \]
        8. Applied rewrites91.8%

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

          \[\leadsto \mathsf{fma}\left(\frac{z \cdot \cos y}{x}, x, x\right) \]
        10. Step-by-step derivation
          1. Applied rewrites91.6%

            \[\leadsto \mathsf{fma}\left(\frac{\cos y \cdot z}{x}, x, x\right) \]

          if -1e9 < z < 7.99999999999999952e-11

          1. Initial program 100.0%

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

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

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

              \[\leadsto \color{blue}{\sin y + x} \]
            3. lower-sin.f6496.8

              \[\leadsto \color{blue}{\sin y} + x \]
          5. Applied rewrites96.8%

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

          if 5.3999999999999998e186 < z

          1. Initial program 99.8%

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

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

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

              \[\leadsto \color{blue}{\left(y + x\right)} + z \cdot \cos y \]
          5. Applied rewrites99.8%

            \[\leadsto \color{blue}{\left(y + x\right)} + z \cdot \cos y \]
        11. Recombined 4 regimes into one program.
        12. Final simplification95.5%

          \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.22 \cdot 10^{+145}:\\ \;\;\;\;z \cdot \cos y\\ \mathbf{elif}\;z \leq -1000000000:\\ \;\;\;\;\mathsf{fma}\left(\frac{z \cdot \cos y}{x}, x, x\right)\\ \mathbf{elif}\;z \leq 8 \cdot 10^{-11}:\\ \;\;\;\;x + \sin y\\ \mathbf{elif}\;z \leq 5.4 \cdot 10^{+186}:\\ \;\;\;\;\mathsf{fma}\left(\frac{z \cdot \cos y}{x}, x, x\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \cos y + \left(x + y\right)\\ \end{array} \]
        13. Add Preprocessing

        Alternative 5: 84.0% accurate, 1.7× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \cos y\\ \mathbf{if}\;z \leq -1.05 \cdot 10^{+14}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 8 \cdot 10^{-11}:\\ \;\;\;\;x + \sin y\\ \mathbf{elif}\;z \leq 2.35 \cdot 10^{+172}:\\ \;\;\;\;x + z\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
        (FPCore (x y z)
         :precision binary64
         (let* ((t_0 (* z (cos y))))
           (if (<= z -1.05e+14)
             t_0
             (if (<= z 8e-11) (+ x (sin y)) (if (<= z 2.35e+172) (+ x z) t_0)))))
        double code(double x, double y, double z) {
        	double t_0 = z * cos(y);
        	double tmp;
        	if (z <= -1.05e+14) {
        		tmp = t_0;
        	} else if (z <= 8e-11) {
        		tmp = x + sin(y);
        	} else if (z <= 2.35e+172) {
        		tmp = x + z;
        	} else {
        		tmp = t_0;
        	}
        	return tmp;
        }
        
        real(8) function code(x, y, z)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            real(8), intent (in) :: z
            real(8) :: t_0
            real(8) :: tmp
            t_0 = z * cos(y)
            if (z <= (-1.05d+14)) then
                tmp = t_0
            else if (z <= 8d-11) then
                tmp = x + sin(y)
            else if (z <= 2.35d+172) then
                tmp = x + z
            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.cos(y);
        	double tmp;
        	if (z <= -1.05e+14) {
        		tmp = t_0;
        	} else if (z <= 8e-11) {
        		tmp = x + Math.sin(y);
        	} else if (z <= 2.35e+172) {
        		tmp = x + z;
        	} else {
        		tmp = t_0;
        	}
        	return tmp;
        }
        
        def code(x, y, z):
        	t_0 = z * math.cos(y)
        	tmp = 0
        	if z <= -1.05e+14:
        		tmp = t_0
        	elif z <= 8e-11:
        		tmp = x + math.sin(y)
        	elif z <= 2.35e+172:
        		tmp = x + z
        	else:
        		tmp = t_0
        	return tmp
        
        function code(x, y, z)
        	t_0 = Float64(z * cos(y))
        	tmp = 0.0
        	if (z <= -1.05e+14)
        		tmp = t_0;
        	elseif (z <= 8e-11)
        		tmp = Float64(x + sin(y));
        	elseif (z <= 2.35e+172)
        		tmp = Float64(x + z);
        	else
        		tmp = t_0;
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y, z)
        	t_0 = z * cos(y);
        	tmp = 0.0;
        	if (z <= -1.05e+14)
        		tmp = t_0;
        	elseif (z <= 8e-11)
        		tmp = x + sin(y);
        	elseif (z <= 2.35e+172)
        		tmp = x + z;
        	else
        		tmp = t_0;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.05e+14], t$95$0, If[LessEqual[z, 8e-11], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.35e+172], N[(x + z), $MachinePrecision], t$95$0]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := z \cdot \cos y\\
        \mathbf{if}\;z \leq -1.05 \cdot 10^{+14}:\\
        \;\;\;\;t\_0\\
        
        \mathbf{elif}\;z \leq 8 \cdot 10^{-11}:\\
        \;\;\;\;x + \sin y\\
        
        \mathbf{elif}\;z \leq 2.35 \cdot 10^{+172}:\\
        \;\;\;\;x + z\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_0\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if z < -1.05e14 or 2.3500000000000001e172 < z

          1. Initial program 99.9%

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

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

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

              \[\leadsto \color{blue}{\cos y \cdot z} \]
            3. lower-cos.f6485.8

              \[\leadsto \color{blue}{\cos y} \cdot z \]
          5. Applied rewrites85.8%

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

          if -1.05e14 < z < 7.99999999999999952e-11

          1. Initial program 100.0%

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

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

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

              \[\leadsto \color{blue}{\sin y + x} \]
            3. lower-sin.f6496.8

              \[\leadsto \color{blue}{\sin y} + x \]
          5. Applied rewrites96.8%

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

          if 7.99999999999999952e-11 < z < 2.3500000000000001e172

          1. Initial program 99.8%

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

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

              \[\leadsto \color{blue}{z + x} \]
            2. lower-+.f6480.1

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

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

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

        Alternative 6: 83.8% accurate, 1.7× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \cos y\\ \mathbf{if}\;z \leq -1.05 \cdot 10^{+14}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 2.35 \cdot 10^{+14}:\\ \;\;\;\;x + \sin y\\ \mathbf{else}:\\ \;\;\;\;t\_0 + \left(x + y\right)\\ \end{array} \end{array} \]
        (FPCore (x y z)
         :precision binary64
         (let* ((t_0 (* z (cos y))))
           (if (<= z -1.05e+14)
             t_0
             (if (<= z 2.35e+14) (+ x (sin y)) (+ t_0 (+ x y))))))
        double code(double x, double y, double z) {
        	double t_0 = z * cos(y);
        	double tmp;
        	if (z <= -1.05e+14) {
        		tmp = t_0;
        	} else if (z <= 2.35e+14) {
        		tmp = x + sin(y);
        	} else {
        		tmp = t_0 + (x + y);
        	}
        	return tmp;
        }
        
        real(8) function code(x, y, z)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            real(8), intent (in) :: z
            real(8) :: t_0
            real(8) :: tmp
            t_0 = z * cos(y)
            if (z <= (-1.05d+14)) then
                tmp = t_0
            else if (z <= 2.35d+14) then
                tmp = x + sin(y)
            else
                tmp = t_0 + (x + y)
            end if
            code = tmp
        end function
        
        public static double code(double x, double y, double z) {
        	double t_0 = z * Math.cos(y);
        	double tmp;
        	if (z <= -1.05e+14) {
        		tmp = t_0;
        	} else if (z <= 2.35e+14) {
        		tmp = x + Math.sin(y);
        	} else {
        		tmp = t_0 + (x + y);
        	}
        	return tmp;
        }
        
        def code(x, y, z):
        	t_0 = z * math.cos(y)
        	tmp = 0
        	if z <= -1.05e+14:
        		tmp = t_0
        	elif z <= 2.35e+14:
        		tmp = x + math.sin(y)
        	else:
        		tmp = t_0 + (x + y)
        	return tmp
        
        function code(x, y, z)
        	t_0 = Float64(z * cos(y))
        	tmp = 0.0
        	if (z <= -1.05e+14)
        		tmp = t_0;
        	elseif (z <= 2.35e+14)
        		tmp = Float64(x + sin(y));
        	else
        		tmp = Float64(t_0 + Float64(x + y));
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y, z)
        	t_0 = z * cos(y);
        	tmp = 0.0;
        	if (z <= -1.05e+14)
        		tmp = t_0;
        	elseif (z <= 2.35e+14)
        		tmp = x + sin(y);
        	else
        		tmp = t_0 + (x + y);
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.05e+14], t$95$0, If[LessEqual[z, 2.35e+14], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(x + y), $MachinePrecision]), $MachinePrecision]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := z \cdot \cos y\\
        \mathbf{if}\;z \leq -1.05 \cdot 10^{+14}:\\
        \;\;\;\;t\_0\\
        
        \mathbf{elif}\;z \leq 2.35 \cdot 10^{+14}:\\
        \;\;\;\;x + \sin y\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_0 + \left(x + y\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if z < -1.05e14

          1. Initial program 99.9%

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

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

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

              \[\leadsto \color{blue}{\cos y \cdot z} \]
            3. lower-cos.f6485.6

              \[\leadsto \color{blue}{\cos y} \cdot z \]
          5. Applied rewrites85.6%

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

          if -1.05e14 < z < 2.35e14

          1. Initial program 100.0%

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

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

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

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

              \[\leadsto \color{blue}{\sin y} + x \]
          5. Applied rewrites95.5%

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

          if 2.35e14 < z

          1. Initial program 99.8%

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

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

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

              \[\leadsto \color{blue}{\left(y + x\right)} + z \cdot \cos y \]
          5. Applied rewrites79.9%

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

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

        Alternative 7: 83.8% accurate, 1.7× speedup?

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

          1. Initial program 99.9%

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

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

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

              \[\leadsto \color{blue}{\cos y \cdot z} \]
            3. lower-cos.f6485.6

              \[\leadsto \color{blue}{\cos y} \cdot z \]
          5. Applied rewrites85.6%

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

          if -1.05e14 < z < 2.35e14

          1. Initial program 100.0%

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

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

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

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

              \[\leadsto \color{blue}{\sin y} + x \]
          5. Applied rewrites95.5%

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

          if 2.35e14 < z

          1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{y + x}\right) \]
        3. Recombined 3 regimes into one program.
        4. Final simplification89.5%

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

        Alternative 8: 77.9% accurate, 1.8× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1000000000:\\ \;\;\;\;x + z\\ \mathbf{elif}\;z \leq 8 \cdot 10^{-11}:\\ \;\;\;\;x + \sin y\\ \mathbf{else}:\\ \;\;\;\;x + z\\ \end{array} \end{array} \]
        (FPCore (x y z)
         :precision binary64
         (if (<= z -1000000000.0) (+ x z) (if (<= z 8e-11) (+ x (sin y)) (+ x z))))
        double code(double x, double y, double z) {
        	double tmp;
        	if (z <= -1000000000.0) {
        		tmp = x + z;
        	} else if (z <= 8e-11) {
        		tmp = x + sin(y);
        	} else {
        		tmp = x + z;
        	}
        	return tmp;
        }
        
        real(8) function code(x, y, z)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            real(8), intent (in) :: z
            real(8) :: tmp
            if (z <= (-1000000000.0d0)) then
                tmp = x + z
            else if (z <= 8d-11) then
                tmp = x + sin(y)
            else
                tmp = x + z
            end if
            code = tmp
        end function
        
        public static double code(double x, double y, double z) {
        	double tmp;
        	if (z <= -1000000000.0) {
        		tmp = x + z;
        	} else if (z <= 8e-11) {
        		tmp = x + Math.sin(y);
        	} else {
        		tmp = x + z;
        	}
        	return tmp;
        }
        
        def code(x, y, z):
        	tmp = 0
        	if z <= -1000000000.0:
        		tmp = x + z
        	elif z <= 8e-11:
        		tmp = x + math.sin(y)
        	else:
        		tmp = x + z
        	return tmp
        
        function code(x, y, z)
        	tmp = 0.0
        	if (z <= -1000000000.0)
        		tmp = Float64(x + z);
        	elseif (z <= 8e-11)
        		tmp = Float64(x + sin(y));
        	else
        		tmp = Float64(x + z);
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y, z)
        	tmp = 0.0;
        	if (z <= -1000000000.0)
        		tmp = x + z;
        	elseif (z <= 8e-11)
        		tmp = x + sin(y);
        	else
        		tmp = x + z;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_, z_] := If[LessEqual[z, -1000000000.0], N[(x + z), $MachinePrecision], If[LessEqual[z, 8e-11], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], N[(x + z), $MachinePrecision]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;z \leq -1000000000:\\
        \;\;\;\;x + z\\
        
        \mathbf{elif}\;z \leq 8 \cdot 10^{-11}:\\
        \;\;\;\;x + \sin y\\
        
        \mathbf{else}:\\
        \;\;\;\;x + z\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if z < -1e9 or 7.99999999999999952e-11 < z

          1. Initial program 99.9%

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

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

              \[\leadsto \color{blue}{z + x} \]
            2. lower-+.f6463.7

              \[\leadsto \color{blue}{z + x} \]
          5. Applied rewrites63.7%

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

          if -1e9 < z < 7.99999999999999952e-11

          1. Initial program 100.0%

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

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

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

              \[\leadsto \color{blue}{\sin y + x} \]
            3. lower-sin.f6496.8

              \[\leadsto \color{blue}{\sin y} + x \]
          5. Applied rewrites96.8%

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

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

        Alternative 9: 69.7% accurate, 5.4× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -5400000000000:\\ \;\;\;\;x + z\\ \mathbf{elif}\;y \leq 18500000000:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, y, -0.5 \cdot z\right), y, 1\right), y, x + z\right)\\ \mathbf{else}:\\ \;\;\;\;x + z\\ \end{array} \end{array} \]
        (FPCore (x y z)
         :precision binary64
         (if (<= y -5400000000000.0)
           (+ x z)
           (if (<= y 18500000000.0)
             (fma (fma (fma -0.16666666666666666 y (* -0.5 z)) y 1.0) y (+ x z))
             (+ x z))))
        double code(double x, double y, double z) {
        	double tmp;
        	if (y <= -5400000000000.0) {
        		tmp = x + z;
        	} else if (y <= 18500000000.0) {
        		tmp = fma(fma(fma(-0.16666666666666666, y, (-0.5 * z)), y, 1.0), y, (x + z));
        	} else {
        		tmp = x + z;
        	}
        	return tmp;
        }
        
        function code(x, y, z)
        	tmp = 0.0
        	if (y <= -5400000000000.0)
        		tmp = Float64(x + z);
        	elseif (y <= 18500000000.0)
        		tmp = fma(fma(fma(-0.16666666666666666, y, Float64(-0.5 * z)), y, 1.0), y, Float64(x + z));
        	else
        		tmp = Float64(x + z);
        	end
        	return tmp
        end
        
        code[x_, y_, z_] := If[LessEqual[y, -5400000000000.0], N[(x + z), $MachinePrecision], If[LessEqual[y, 18500000000.0], N[(N[(N[(-0.16666666666666666 * y + N[(-0.5 * z), $MachinePrecision]), $MachinePrecision] * y + 1.0), $MachinePrecision] * y + N[(x + z), $MachinePrecision]), $MachinePrecision], N[(x + z), $MachinePrecision]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;y \leq -5400000000000:\\
        \;\;\;\;x + z\\
        
        \mathbf{elif}\;y \leq 18500000000:\\
        \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, y, -0.5 \cdot z\right), y, 1\right), y, x + z\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;x + z\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if y < -5.4e12 or 1.85e10 < y

          1. Initial program 99.9%

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

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

              \[\leadsto \color{blue}{z + x} \]
            2. lower-+.f6441.6

              \[\leadsto \color{blue}{z + x} \]
          5. Applied rewrites41.6%

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

          if -5.4e12 < y < 1.85e10

          1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        Alternative 10: 69.7% accurate, 6.4× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -12000000000000:\\ \;\;\;\;x + z\\ \mathbf{elif}\;y \leq 31500000:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.5 \cdot y, z, 1\right), y, x + z\right)\\ \mathbf{else}:\\ \;\;\;\;x + z\\ \end{array} \end{array} \]
        (FPCore (x y z)
         :precision binary64
         (if (<= y -12000000000000.0)
           (+ x z)
           (if (<= y 31500000.0) (fma (fma (* -0.5 y) z 1.0) y (+ x z)) (+ x z))))
        double code(double x, double y, double z) {
        	double tmp;
        	if (y <= -12000000000000.0) {
        		tmp = x + z;
        	} else if (y <= 31500000.0) {
        		tmp = fma(fma((-0.5 * y), z, 1.0), y, (x + z));
        	} else {
        		tmp = x + z;
        	}
        	return tmp;
        }
        
        function code(x, y, z)
        	tmp = 0.0
        	if (y <= -12000000000000.0)
        		tmp = Float64(x + z);
        	elseif (y <= 31500000.0)
        		tmp = fma(fma(Float64(-0.5 * y), z, 1.0), y, Float64(x + z));
        	else
        		tmp = Float64(x + z);
        	end
        	return tmp
        end
        
        code[x_, y_, z_] := If[LessEqual[y, -12000000000000.0], N[(x + z), $MachinePrecision], If[LessEqual[y, 31500000.0], N[(N[(N[(-0.5 * y), $MachinePrecision] * z + 1.0), $MachinePrecision] * y + N[(x + z), $MachinePrecision]), $MachinePrecision], N[(x + z), $MachinePrecision]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;y \leq -12000000000000:\\
        \;\;\;\;x + z\\
        
        \mathbf{elif}\;y \leq 31500000:\\
        \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.5 \cdot y, z, 1\right), y, x + z\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;x + z\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if y < -1.2e13 or 3.15e7 < y

          1. Initial program 99.9%

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

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

              \[\leadsto \color{blue}{z + x} \]
            2. lower-+.f6441.6

              \[\leadsto \color{blue}{z + x} \]
          5. Applied rewrites41.6%

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

          if -1.2e13 < y < 3.15e7

          1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -12000000000000:\\ \;\;\;\;x + z\\ \mathbf{elif}\;y \leq 31500000:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.5 \cdot y, z, 1\right), y, x + z\right)\\ \mathbf{else}:\\ \;\;\;\;x + z\\ \end{array} \]
        5. Add Preprocessing

        Alternative 11: 69.4% accurate, 11.1× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -2.6 \cdot 10^{+54}:\\ \;\;\;\;x + z\\ \mathbf{elif}\;y \leq 5 \cdot 10^{+58}:\\ \;\;\;\;\left(x + y\right) + z\\ \mathbf{else}:\\ \;\;\;\;x + z\\ \end{array} \end{array} \]
        (FPCore (x y z)
         :precision binary64
         (if (<= y -2.6e+54) (+ x z) (if (<= y 5e+58) (+ (+ x y) z) (+ x z))))
        double code(double x, double y, double z) {
        	double tmp;
        	if (y <= -2.6e+54) {
        		tmp = x + z;
        	} else if (y <= 5e+58) {
        		tmp = (x + y) + z;
        	} else {
        		tmp = x + z;
        	}
        	return tmp;
        }
        
        real(8) function code(x, y, z)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            real(8), intent (in) :: z
            real(8) :: tmp
            if (y <= (-2.6d+54)) then
                tmp = x + z
            else if (y <= 5d+58) then
                tmp = (x + y) + z
            else
                tmp = x + z
            end if
            code = tmp
        end function
        
        public static double code(double x, double y, double z) {
        	double tmp;
        	if (y <= -2.6e+54) {
        		tmp = x + z;
        	} else if (y <= 5e+58) {
        		tmp = (x + y) + z;
        	} else {
        		tmp = x + z;
        	}
        	return tmp;
        }
        
        def code(x, y, z):
        	tmp = 0
        	if y <= -2.6e+54:
        		tmp = x + z
        	elif y <= 5e+58:
        		tmp = (x + y) + z
        	else:
        		tmp = x + z
        	return tmp
        
        function code(x, y, z)
        	tmp = 0.0
        	if (y <= -2.6e+54)
        		tmp = Float64(x + z);
        	elseif (y <= 5e+58)
        		tmp = Float64(Float64(x + y) + z);
        	else
        		tmp = Float64(x + z);
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y, z)
        	tmp = 0.0;
        	if (y <= -2.6e+54)
        		tmp = x + z;
        	elseif (y <= 5e+58)
        		tmp = (x + y) + z;
        	else
        		tmp = x + z;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_, z_] := If[LessEqual[y, -2.6e+54], N[(x + z), $MachinePrecision], If[LessEqual[y, 5e+58], N[(N[(x + y), $MachinePrecision] + z), $MachinePrecision], N[(x + z), $MachinePrecision]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;y \leq -2.6 \cdot 10^{+54}:\\
        \;\;\;\;x + z\\
        
        \mathbf{elif}\;y \leq 5 \cdot 10^{+58}:\\
        \;\;\;\;\left(x + y\right) + z\\
        
        \mathbf{else}:\\
        \;\;\;\;x + z\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if y < -2.60000000000000007e54 or 4.99999999999999986e58 < y

          1. Initial program 99.9%

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

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

              \[\leadsto \color{blue}{z + x} \]
            2. lower-+.f6443.7

              \[\leadsto \color{blue}{z + x} \]
          5. Applied rewrites43.7%

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

          if -2.60000000000000007e54 < y < 4.99999999999999986e58

          1. Initial program 100.0%

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

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

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

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

              \[\leadsto \color{blue}{\left(y + x\right)} + z \]
            4. lower-+.f6487.1

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

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

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

        Alternative 12: 67.4% accurate, 13.2× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -3.8 \cdot 10^{-94}:\\ \;\;\;\;x + z\\ \mathbf{elif}\;x \leq 2.4 \cdot 10^{-124}:\\ \;\;\;\;z + y\\ \mathbf{else}:\\ \;\;\;\;x + z\\ \end{array} \end{array} \]
        (FPCore (x y z)
         :precision binary64
         (if (<= x -3.8e-94) (+ x z) (if (<= x 2.4e-124) (+ z y) (+ x z))))
        double code(double x, double y, double z) {
        	double tmp;
        	if (x <= -3.8e-94) {
        		tmp = x + z;
        	} else if (x <= 2.4e-124) {
        		tmp = z + y;
        	} else {
        		tmp = x + z;
        	}
        	return tmp;
        }
        
        real(8) function code(x, y, z)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            real(8), intent (in) :: z
            real(8) :: tmp
            if (x <= (-3.8d-94)) then
                tmp = x + z
            else if (x <= 2.4d-124) then
                tmp = z + y
            else
                tmp = x + z
            end if
            code = tmp
        end function
        
        public static double code(double x, double y, double z) {
        	double tmp;
        	if (x <= -3.8e-94) {
        		tmp = x + z;
        	} else if (x <= 2.4e-124) {
        		tmp = z + y;
        	} else {
        		tmp = x + z;
        	}
        	return tmp;
        }
        
        def code(x, y, z):
        	tmp = 0
        	if x <= -3.8e-94:
        		tmp = x + z
        	elif x <= 2.4e-124:
        		tmp = z + y
        	else:
        		tmp = x + z
        	return tmp
        
        function code(x, y, z)
        	tmp = 0.0
        	if (x <= -3.8e-94)
        		tmp = Float64(x + z);
        	elseif (x <= 2.4e-124)
        		tmp = Float64(z + y);
        	else
        		tmp = Float64(x + z);
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y, z)
        	tmp = 0.0;
        	if (x <= -3.8e-94)
        		tmp = x + z;
        	elseif (x <= 2.4e-124)
        		tmp = z + y;
        	else
        		tmp = x + z;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_, z_] := If[LessEqual[x, -3.8e-94], N[(x + z), $MachinePrecision], If[LessEqual[x, 2.4e-124], N[(z + y), $MachinePrecision], N[(x + z), $MachinePrecision]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;x \leq -3.8 \cdot 10^{-94}:\\
        \;\;\;\;x + z\\
        
        \mathbf{elif}\;x \leq 2.4 \cdot 10^{-124}:\\
        \;\;\;\;z + y\\
        
        \mathbf{else}:\\
        \;\;\;\;x + z\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if x < -3.79999999999999999e-94 or 2.39999999999999992e-124 < x

          1. Initial program 99.9%

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

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

              \[\leadsto \color{blue}{z + x} \]
            2. lower-+.f6478.8

              \[\leadsto \color{blue}{z + x} \]
          5. Applied rewrites78.8%

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

          if -3.79999999999999999e-94 < x < 2.39999999999999992e-124

          1. Initial program 99.9%

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

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

              \[\leadsto \color{blue}{z + x} \]
            2. lower-+.f6434.1

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

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

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

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

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

              \[\leadsto \color{blue}{\left(z + y\right)} + x \]
            4. lower-+.f6446.4

              \[\leadsto \color{blue}{\left(z + y\right)} + x \]
          8. Applied rewrites46.4%

            \[\leadsto \color{blue}{\left(z + y\right) + x} \]
          9. Taylor expanded in x around 0

            \[\leadsto y + \color{blue}{z} \]
          10. Step-by-step derivation
            1. Applied rewrites44.7%

              \[\leadsto z + \color{blue}{y} \]
          11. Recombined 2 regimes into one program.
          12. Final simplification68.3%

            \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.8 \cdot 10^{-94}:\\ \;\;\;\;x + z\\ \mathbf{elif}\;x \leq 2.4 \cdot 10^{-124}:\\ \;\;\;\;z + y\\ \mathbf{else}:\\ \;\;\;\;x + z\\ \end{array} \]
          13. Add Preprocessing

          Alternative 13: 46.7% accurate, 13.2× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.26 \cdot 10^{+14}:\\ \;\;\;\;z + y\\ \mathbf{elif}\;z \leq 6.4 \cdot 10^{+164}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;z + y\\ \end{array} \end{array} \]
          (FPCore (x y z)
           :precision binary64
           (if (<= z -1.26e+14) (+ z y) (if (<= z 6.4e+164) (+ x y) (+ z y))))
          double code(double x, double y, double z) {
          	double tmp;
          	if (z <= -1.26e+14) {
          		tmp = z + y;
          	} else if (z <= 6.4e+164) {
          		tmp = x + y;
          	} else {
          		tmp = z + y;
          	}
          	return tmp;
          }
          
          real(8) function code(x, y, z)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              real(8), intent (in) :: z
              real(8) :: tmp
              if (z <= (-1.26d+14)) then
                  tmp = z + y
              else if (z <= 6.4d+164) then
                  tmp = x + y
              else
                  tmp = z + y
              end if
              code = tmp
          end function
          
          public static double code(double x, double y, double z) {
          	double tmp;
          	if (z <= -1.26e+14) {
          		tmp = z + y;
          	} else if (z <= 6.4e+164) {
          		tmp = x + y;
          	} else {
          		tmp = z + y;
          	}
          	return tmp;
          }
          
          def code(x, y, z):
          	tmp = 0
          	if z <= -1.26e+14:
          		tmp = z + y
          	elif z <= 6.4e+164:
          		tmp = x + y
          	else:
          		tmp = z + y
          	return tmp
          
          function code(x, y, z)
          	tmp = 0.0
          	if (z <= -1.26e+14)
          		tmp = Float64(z + y);
          	elseif (z <= 6.4e+164)
          		tmp = Float64(x + y);
          	else
          		tmp = Float64(z + y);
          	end
          	return tmp
          end
          
          function tmp_2 = code(x, y, z)
          	tmp = 0.0;
          	if (z <= -1.26e+14)
          		tmp = z + y;
          	elseif (z <= 6.4e+164)
          		tmp = x + y;
          	else
          		tmp = z + y;
          	end
          	tmp_2 = tmp;
          end
          
          code[x_, y_, z_] := If[LessEqual[z, -1.26e+14], N[(z + y), $MachinePrecision], If[LessEqual[z, 6.4e+164], N[(x + y), $MachinePrecision], N[(z + y), $MachinePrecision]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;z \leq -1.26 \cdot 10^{+14}:\\
          \;\;\;\;z + y\\
          
          \mathbf{elif}\;z \leq 6.4 \cdot 10^{+164}:\\
          \;\;\;\;x + y\\
          
          \mathbf{else}:\\
          \;\;\;\;z + y\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if z < -1.26e14 or 6.3999999999999996e164 < z

            1. Initial program 99.9%

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

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

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

                \[\leadsto \color{blue}{z + x} \]
            5. Applied rewrites56.9%

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

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

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

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

                \[\leadsto \color{blue}{\left(z + y\right)} + x \]
              4. lower-+.f6453.0

                \[\leadsto \color{blue}{\left(z + y\right)} + x \]
            8. Applied rewrites53.0%

              \[\leadsto \color{blue}{\left(z + y\right) + x} \]
            9. Taylor expanded in x around 0

              \[\leadsto y + \color{blue}{z} \]
            10. Step-by-step derivation
              1. Applied rewrites43.9%

                \[\leadsto z + \color{blue}{y} \]

              if -1.26e14 < z < 6.3999999999999996e164

              1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto x + \color{blue}{y} \]
              7. Step-by-step derivation
                1. Applied rewrites56.2%

                  \[\leadsto y + \color{blue}{x} \]
              8. Recombined 2 regimes into one program.
              9. Final simplification51.9%

                \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.26 \cdot 10^{+14}:\\ \;\;\;\;z + y\\ \mathbf{elif}\;z \leq 6.4 \cdot 10^{+164}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;z + y\\ \end{array} \]
              10. Add Preprocessing

              Alternative 14: 38.7% accurate, 53.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto x + \color{blue}{y} \]
              7. Step-by-step derivation
                1. Applied rewrites40.9%

                  \[\leadsto y + \color{blue}{x} \]
                2. Final simplification40.9%

                  \[\leadsto x + y \]
                3. Add Preprocessing

                Reproduce

                ?
                herbie shell --seed 2024244 
                (FPCore (x y z)
                  :name "Graphics.Rasterific.Svg.PathConverter:segmentToBezier from rasterific-svg-0.2.3.1, C"
                  :precision binary64
                  (+ (+ x (sin y)) (* z (cos y))))