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

Percentage Accurate: 99.9% → 99.9%
Time: 9.8s
Alternatives: 9
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 9 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)} \]
  4. Applied rewrites99.9%

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

Alternative 2: 79.2% accurate, 0.2× speedup?

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

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

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

\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-12}:\\
\;\;\;\;y + \left(z + x\right)\\

\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+18}:\\
\;\;\;\;\sin y\\

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


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

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

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

    if -1.99999999999999992e28 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < -0.0050000000000000001 or 4.9999999999999997e-12 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 2e18

    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. lower-fma.f64N/A

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

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

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

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

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

        \[\leadsto \sin y \]

      if -0.0050000000000000001 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 4.9999999999999997e-12

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{y + \left(z + x\right)} \]
    8. Recombined 3 regimes into one program.
    9. Final simplification83.3%

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

    Alternative 3: 95.4% accurate, 1.0× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(x, \frac{\cos y \cdot z}{x}, x\right)\\ \mathbf{if}\;x \leq -14500000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 2.8 \cdot 10^{-23}:\\ \;\;\;\;\mathsf{fma}\left(z, \cos y, \sin y\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
    (FPCore (x y z)
     :precision binary64
     (let* ((t_0 (fma x (/ (* (cos y) z) x) x)))
       (if (<= x -14500000.0)
         t_0
         (if (<= x 2.8e-23) (fma z (cos y) (sin y)) t_0))))
    double code(double x, double y, double z) {
    	double t_0 = fma(x, ((cos(y) * z) / x), x);
    	double tmp;
    	if (x <= -14500000.0) {
    		tmp = t_0;
    	} else if (x <= 2.8e-23) {
    		tmp = fma(z, cos(y), sin(y));
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    function code(x, y, z)
    	t_0 = fma(x, Float64(Float64(cos(y) * z) / x), x)
    	tmp = 0.0
    	if (x <= -14500000.0)
    		tmp = t_0;
    	elseif (x <= 2.8e-23)
    		tmp = fma(z, cos(y), sin(y));
    	else
    		tmp = t_0;
    	end
    	return tmp
    end
    
    code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(N[(N[Cos[y], $MachinePrecision] * z), $MachinePrecision] / x), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[x, -14500000.0], t$95$0, If[LessEqual[x, 2.8e-23], N[(z * N[Cos[y], $MachinePrecision] + N[Sin[y], $MachinePrecision]), $MachinePrecision], t$95$0]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \mathsf{fma}\left(x, \frac{\cos y \cdot z}{x}, x\right)\\
    \mathbf{if}\;x \leq -14500000:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;x \leq 2.8 \cdot 10^{-23}:\\
    \;\;\;\;\mathsf{fma}\left(z, \cos y, \sin y\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if x < -1.45e7 or 2.7999999999999997e-23 < 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-+.f6489.7

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        if -1.45e7 < x < 2.7999999999999997e-23

        1. Initial program 99.8%

          \[\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. lower-fma.f64N/A

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

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

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

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

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

      Alternative 4: 88.2% accurate, 1.4× speedup?

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

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

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

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

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

        if -8.50000000000000038e67 < z < -1.45e-25

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(x, \frac{z \cdot \cos y}{\color{blue}{x}}, x\right) \]
          3. Step-by-step derivation
            1. Applied rewrites93.8%

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

            if -1.45e-25 < z < 3.1999999999999997e-20

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

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

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

            if 3.1999999999999997e-20 < z < 6.80000000000000041e152

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \mathsf{fma}\left(x, \frac{z \cdot \cos y}{\color{blue}{x}}, x\right) \]
            11. Recombined 4 regimes into one program.
            12. Final simplification89.7%

              \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -8.5 \cdot 10^{+67}:\\ \;\;\;\;\cos y \cdot z\\ \mathbf{elif}\;z \leq -1.45 \cdot 10^{-25}:\\ \;\;\;\;\mathsf{fma}\left(x, \cos y \cdot \frac{z}{x}, x\right)\\ \mathbf{elif}\;z \leq 3.2 \cdot 10^{-20}:\\ \;\;\;\;x + \sin y\\ \mathbf{elif}\;z \leq 6.8 \cdot 10^{+152}:\\ \;\;\;\;\mathsf{fma}\left(x, \frac{\cos y \cdot z}{x}, x\right)\\ \mathbf{else}:\\ \;\;\;\;\cos y \cdot z\\ \end{array} \]
            13. Add Preprocessing

            Alternative 5: 88.2% accurate, 1.4× speedup?

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

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

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

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

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

              if -8.50000000000000038e67 < z < -1.45e-25 or 3.1999999999999997e-20 < z < 6.80000000000000041e152

              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-+.f6475.6

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \mathsf{fma}\left(x, \frac{z \cdot \cos y}{\color{blue}{x}}, x\right) \]
                3. Step-by-step derivation
                  1. Applied rewrites90.8%

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

                  if -1.45e-25 < z < 3.1999999999999997e-20

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

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

                    \[\leadsto \color{blue}{\sin y + x} \]
                4. Recombined 3 regimes into one program.
                5. Final simplification89.7%

                  \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -8.5 \cdot 10^{+67}:\\ \;\;\;\;\cos y \cdot z\\ \mathbf{elif}\;z \leq -1.45 \cdot 10^{-25}:\\ \;\;\;\;\mathsf{fma}\left(x, \cos y \cdot \frac{z}{x}, x\right)\\ \mathbf{elif}\;z \leq 3.2 \cdot 10^{-20}:\\ \;\;\;\;x + \sin y\\ \mathbf{elif}\;z \leq 6.8 \cdot 10^{+152}:\\ \;\;\;\;\mathsf{fma}\left(x, \cos y \cdot \frac{z}{x}, x\right)\\ \mathbf{else}:\\ \;\;\;\;\cos y \cdot z\\ \end{array} \]
                6. Add Preprocessing

                Alternative 6: 82.9% accurate, 1.7× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos y \cdot z\\ \mathbf{if}\;z \leq -9 \cdot 10^{+230}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -1.6 \cdot 10^{-25}:\\ \;\;\;\;z + x\\ \mathbf{elif}\;z \leq 3.85 \cdot 10^{+65}:\\ \;\;\;\;x + \sin y\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                (FPCore (x y z)
                 :precision binary64
                 (let* ((t_0 (* (cos y) z)))
                   (if (<= z -9e+230)
                     t_0
                     (if (<= z -1.6e-25) (+ z x) (if (<= z 3.85e+65) (+ x (sin y)) t_0)))))
                double code(double x, double y, double z) {
                	double t_0 = cos(y) * z;
                	double tmp;
                	if (z <= -9e+230) {
                		tmp = t_0;
                	} else if (z <= -1.6e-25) {
                		tmp = z + x;
                	} else if (z <= 3.85e+65) {
                		tmp = x + sin(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 = cos(y) * z
                    if (z <= (-9d+230)) then
                        tmp = t_0
                    else if (z <= (-1.6d-25)) then
                        tmp = z + x
                    else if (z <= 3.85d+65) then
                        tmp = x + sin(y)
                    else
                        tmp = t_0
                    end if
                    code = tmp
                end function
                
                public static double code(double x, double y, double z) {
                	double t_0 = Math.cos(y) * z;
                	double tmp;
                	if (z <= -9e+230) {
                		tmp = t_0;
                	} else if (z <= -1.6e-25) {
                		tmp = z + x;
                	} else if (z <= 3.85e+65) {
                		tmp = x + Math.sin(y);
                	} else {
                		tmp = t_0;
                	}
                	return tmp;
                }
                
                def code(x, y, z):
                	t_0 = math.cos(y) * z
                	tmp = 0
                	if z <= -9e+230:
                		tmp = t_0
                	elif z <= -1.6e-25:
                		tmp = z + x
                	elif z <= 3.85e+65:
                		tmp = x + math.sin(y)
                	else:
                		tmp = t_0
                	return tmp
                
                function code(x, y, z)
                	t_0 = Float64(cos(y) * z)
                	tmp = 0.0
                	if (z <= -9e+230)
                		tmp = t_0;
                	elseif (z <= -1.6e-25)
                		tmp = Float64(z + x);
                	elseif (z <= 3.85e+65)
                		tmp = Float64(x + sin(y));
                	else
                		tmp = t_0;
                	end
                	return tmp
                end
                
                function tmp_2 = code(x, y, z)
                	t_0 = cos(y) * z;
                	tmp = 0.0;
                	if (z <= -9e+230)
                		tmp = t_0;
                	elseif (z <= -1.6e-25)
                		tmp = z + x;
                	elseif (z <= 3.85e+65)
                		tmp = x + sin(y);
                	else
                		tmp = t_0;
                	end
                	tmp_2 = tmp;
                end
                
                code[x_, y_, z_] := Block[{t$95$0 = N[(N[Cos[y], $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -9e+230], t$95$0, If[LessEqual[z, -1.6e-25], N[(z + x), $MachinePrecision], If[LessEqual[z, 3.85e+65], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], t$95$0]]]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                t_0 := \cos y \cdot z\\
                \mathbf{if}\;z \leq -9 \cdot 10^{+230}:\\
                \;\;\;\;t\_0\\
                
                \mathbf{elif}\;z \leq -1.6 \cdot 10^{-25}:\\
                \;\;\;\;z + x\\
                
                \mathbf{elif}\;z \leq 3.85 \cdot 10^{+65}:\\
                \;\;\;\;x + \sin y\\
                
                \mathbf{else}:\\
                \;\;\;\;t\_0\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 3 regimes
                2. if z < -8.9999999999999998e230 or 3.85000000000000019e65 < z

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

                      \[\leadsto \color{blue}{z \cdot \cos y} \]
                    2. lower-cos.f6487.0

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

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

                  if -8.9999999999999998e230 < z < -1.6000000000000001e-25

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

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

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

                  if -1.6000000000000001e-25 < z < 3.85000000000000019e65

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

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

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

                  \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -9 \cdot 10^{+230}:\\ \;\;\;\;\cos y \cdot z\\ \mathbf{elif}\;z \leq -1.6 \cdot 10^{-25}:\\ \;\;\;\;z + x\\ \mathbf{elif}\;z \leq 3.85 \cdot 10^{+65}:\\ \;\;\;\;x + \sin y\\ \mathbf{else}:\\ \;\;\;\;\cos y \cdot z\\ \end{array} \]
                5. Add Preprocessing

                Alternative 7: 80.7% accurate, 1.8× speedup?

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

                  1. Initial program 99.8%

                    \[\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.f6464.8

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

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

                  if -2.25000000000000007e50 < y < 0.030499999999999999

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

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

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

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

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

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

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

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

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

                Alternative 8: 66.4% accurate, 53.0× speedup?

                \[\begin{array}{l} \\ z + x \end{array} \]
                (FPCore (x y z) :precision binary64 (+ z x))
                double code(double x, double y, double z) {
                	return z + x;
                }
                
                real(8) function code(x, y, z)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    real(8), intent (in) :: z
                    code = z + x
                end function
                
                public static double code(double x, double y, double z) {
                	return z + x;
                }
                
                def code(x, y, z):
                	return z + x
                
                function code(x, y, z)
                	return Float64(z + x)
                end
                
                function tmp = code(x, y, z)
                	tmp = z + x;
                end
                
                code[x_, y_, z_] := N[(z + x), $MachinePrecision]
                
                \begin{array}{l}
                
                \\
                z + x
                \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 + z} \]
                4. Step-by-step derivation
                  1. +-commutativeN/A

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

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

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

                Alternative 9: 30.1% accurate, 53.0× speedup?

                \[\begin{array}{l} \\ y + z \end{array} \]
                (FPCore (x y z) :precision binary64 (+ y z))
                double code(double x, double y, double z) {
                	return y + z;
                }
                
                real(8) function code(x, y, z)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    real(8), intent (in) :: z
                    code = y + z
                end function
                
                public static double code(double x, double y, double z) {
                	return y + z;
                }
                
                def code(x, y, z):
                	return y + z
                
                function code(x, y, z)
                	return Float64(y + z)
                end
                
                function tmp = code(x, y, z)
                	tmp = y + z;
                end
                
                code[x_, y_, z_] := N[(y + z), $MachinePrecision]
                
                \begin{array}{l}
                
                \\
                y + z
                \end{array}
                
                Derivation
                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. lower-fma.f64N/A

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

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

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

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

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

                    \[\leadsto z + \color{blue}{y} \]
                  2. Final simplification30.9%

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

                  Reproduce

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