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

Percentage Accurate: 99.9% → 99.9%
Time: 8.0s
Alternatives: 11
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 11 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: 81.4% 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 -5000000:\\ \;\;\;\;x + z\\ \mathbf{elif}\;t\_0 \leq -0.05:\\ \;\;\;\;\sin y\\ \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-21}:\\ \;\;\;\;\left(x + y\right) + z\\ \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 -5000000.0)
     (+ x z)
     (if (<= t_0 -0.05)
       (sin y)
       (if (<= t_0 5e-21) (+ (+ x y) 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 <= -5000000.0) {
		tmp = x + z;
	} else if (t_0 <= -0.05) {
		tmp = sin(y);
	} else if (t_0 <= 5e-21) {
		tmp = (x + y) + z;
	} else if (t_0 <= 1.0) {
		tmp = 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) :: t_0
    real(8) :: tmp
    t_0 = (z * cos(y)) + (x + sin(y))
    if (t_0 <= (-5000000.0d0)) then
        tmp = x + z
    else if (t_0 <= (-0.05d0)) then
        tmp = sin(y)
    else if (t_0 <= 5d-21) then
        tmp = (x + y) + z
    else if (t_0 <= 1.0d0) then
        tmp = sin(y)
    else
        tmp = x + z
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = (z * Math.cos(y)) + (x + Math.sin(y));
	double tmp;
	if (t_0 <= -5000000.0) {
		tmp = x + z;
	} else if (t_0 <= -0.05) {
		tmp = Math.sin(y);
	} else if (t_0 <= 5e-21) {
		tmp = (x + y) + z;
	} else if (t_0 <= 1.0) {
		tmp = Math.sin(y);
	} else {
		tmp = x + z;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = (z * math.cos(y)) + (x + math.sin(y))
	tmp = 0
	if t_0 <= -5000000.0:
		tmp = x + z
	elif t_0 <= -0.05:
		tmp = math.sin(y)
	elif t_0 <= 5e-21:
		tmp = (x + y) + z
	elif t_0 <= 1.0:
		tmp = math.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 <= -5000000.0)
		tmp = Float64(x + z);
	elseif (t_0 <= -0.05)
		tmp = sin(y);
	elseif (t_0 <= 5e-21)
		tmp = Float64(Float64(x + y) + z);
	elseif (t_0 <= 1.0)
		tmp = sin(y);
	else
		tmp = Float64(x + z);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = (z * cos(y)) + (x + sin(y));
	tmp = 0.0;
	if (t_0 <= -5000000.0)
		tmp = x + z;
	elseif (t_0 <= -0.05)
		tmp = sin(y);
	elseif (t_0 <= 5e-21)
		tmp = (x + y) + z;
	elseif (t_0 <= 1.0)
		tmp = sin(y);
	else
		tmp = x + z;
	end
	tmp_2 = 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, -5000000.0], N[(x + z), $MachinePrecision], If[LessEqual[t$95$0, -0.05], N[Sin[y], $MachinePrecision], If[LessEqual[t$95$0, 5e-21], N[(N[(x + y), $MachinePrecision] + z), $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 -5000000:\\
\;\;\;\;x + z\\

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

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

\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))) < -5e6 or 1 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y)))

    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-+.f6473.4

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

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

    if -5e6 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < -0.050000000000000003 or 4.99999999999999973e-21 < (+.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 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.f6497.7

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

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

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

        \[\leadsto \sin y \]

      if -0.050000000000000003 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 4.99999999999999973e-21

      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-+.f64100.0

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot \cos y + \left(x + \sin y\right) \leq -5000000:\\ \;\;\;\;x + z\\ \mathbf{elif}\;z \cdot \cos y + \left(x + \sin y\right) \leq -0.05:\\ \;\;\;\;\sin y\\ \mathbf{elif}\;z \cdot \cos y + \left(x + \sin y\right) \leq 5 \cdot 10^{-21}:\\ \;\;\;\;\left(x + y\right) + z\\ \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: 67.3% accurate, 0.5× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \cos y + \left(x + \sin y\right)\\ \mathbf{if}\;t\_0 \leq -1 \cdot 10^{-45}:\\ \;\;\;\;x + z\\ \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-111}:\\ \;\;\;\;x + 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 -1e-45) (+ x z) (if (<= t_0 2e-111) (+ x 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 <= -1e-45) {
    		tmp = x + z;
    	} else if (t_0 <= 2e-111) {
    		tmp = x + 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) :: t_0
        real(8) :: tmp
        t_0 = (z * cos(y)) + (x + sin(y))
        if (t_0 <= (-1d-45)) then
            tmp = x + z
        else if (t_0 <= 2d-111) then
            tmp = x + y
        else
            tmp = x + z
        end if
        code = tmp
    end function
    
    public static double code(double x, double y, double z) {
    	double t_0 = (z * Math.cos(y)) + (x + Math.sin(y));
    	double tmp;
    	if (t_0 <= -1e-45) {
    		tmp = x + z;
    	} else if (t_0 <= 2e-111) {
    		tmp = x + y;
    	} else {
    		tmp = x + z;
    	}
    	return tmp;
    }
    
    def code(x, y, z):
    	t_0 = (z * math.cos(y)) + (x + math.sin(y))
    	tmp = 0
    	if t_0 <= -1e-45:
    		tmp = x + z
    	elif t_0 <= 2e-111:
    		tmp = x + 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 <= -1e-45)
    		tmp = Float64(x + z);
    	elseif (t_0 <= 2e-111)
    		tmp = Float64(x + y);
    	else
    		tmp = Float64(x + z);
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y, z)
    	t_0 = (z * cos(y)) + (x + sin(y));
    	tmp = 0.0;
    	if (t_0 <= -1e-45)
    		tmp = x + z;
    	elseif (t_0 <= 2e-111)
    		tmp = x + y;
    	else
    		tmp = x + z;
    	end
    	tmp_2 = 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, -1e-45], N[(x + z), $MachinePrecision], If[LessEqual[t$95$0, 2e-111], N[(x + 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 -1 \cdot 10^{-45}:\\
    \;\;\;\;x + z\\
    
    \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-111}:\\
    \;\;\;\;x + y\\
    
    \mathbf{else}:\\
    \;\;\;\;x + z\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < -9.99999999999999984e-46 or 2.00000000000000018e-111 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y)))

      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-+.f6465.9

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

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

      if -9.99999999999999984e-46 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 2.00000000000000018e-111

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

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

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

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

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

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

      Alternative 4: 95.4% accurate, 1.0× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(\frac{z \cdot \cos y}{x} - -1\right) \cdot x\\ \mathbf{if}\;x \leq -1.8 \cdot 10^{-43}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 1.9 \cdot 10^{-21}:\\ \;\;\;\;\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 (* (- (/ (* z (cos y)) x) -1.0) x)))
         (if (<= x -1.8e-43) t_0 (if (<= x 1.9e-21) (fma (cos y) z (sin y)) t_0))))
      double code(double x, double y, double z) {
      	double t_0 = (((z * cos(y)) / x) - -1.0) * x;
      	double tmp;
      	if (x <= -1.8e-43) {
      		tmp = t_0;
      	} else if (x <= 1.9e-21) {
      		tmp = fma(cos(y), z, sin(y));
      	} else {
      		tmp = t_0;
      	}
      	return tmp;
      }
      
      function code(x, y, z)
      	t_0 = Float64(Float64(Float64(Float64(z * cos(y)) / x) - -1.0) * x)
      	tmp = 0.0
      	if (x <= -1.8e-43)
      		tmp = t_0;
      	elseif (x <= 1.9e-21)
      		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[(N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] - -1.0), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -1.8e-43], t$95$0, If[LessEqual[x, 1.9e-21], N[(N[Cos[y], $MachinePrecision] * z + N[Sin[y], $MachinePrecision]), $MachinePrecision], t$95$0]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := \left(\frac{z \cdot \cos y}{x} - -1\right) \cdot x\\
      \mathbf{if}\;x \leq -1.8 \cdot 10^{-43}:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;x \leq 1.9 \cdot 10^{-21}:\\
      \;\;\;\;\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.7999999999999999e-43 or 1.8999999999999999e-21 < x

        1. Initial program 99.9%

          \[\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.f6469.2

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

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

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

            \[\leadsto y + \color{blue}{x} \]
          2. 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)} \]
          3. Step-by-step derivation
            1. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \left(-x\right) \cdot \left(-1 - \frac{z \cdot \cos y}{x}\right) \]
          6. Step-by-step derivation
            1. Applied rewrites98.5%

              \[\leadsto \left(-x\right) \cdot \left(-1 - \frac{\cos y \cdot z}{x}\right) \]

            if -1.7999999999999999e-43 < x < 1.8999999999999999e-21

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

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

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

            \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.8 \cdot 10^{-43}:\\ \;\;\;\;\left(\frac{z \cdot \cos y}{x} - -1\right) \cdot x\\ \mathbf{elif}\;x \leq 1.9 \cdot 10^{-21}:\\ \;\;\;\;\mathsf{fma}\left(\cos y, z, \sin y\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{z \cdot \cos y}{x} - -1\right) \cdot x\\ \end{array} \]
          9. Add Preprocessing

          Alternative 5: 83.6% accurate, 1.7× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \cos y\\ \mathbf{if}\;z \leq -5.4 \cdot 10^{+17}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 2 \cdot 10^{-94}:\\ \;\;\;\;x + \sin y\\ \mathbf{elif}\;z \leq 3 \cdot 10^{+129}:\\ \;\;\;\;x + z\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
          (FPCore (x y z)
           :precision binary64
           (let* ((t_0 (* z (cos y))))
             (if (<= z -5.4e+17)
               t_0
               (if (<= z 2e-94) (+ x (sin y)) (if (<= z 3e+129) (+ x z) t_0)))))
          double code(double x, double y, double z) {
          	double t_0 = z * cos(y);
          	double tmp;
          	if (z <= -5.4e+17) {
          		tmp = t_0;
          	} else if (z <= 2e-94) {
          		tmp = x + sin(y);
          	} else if (z <= 3e+129) {
          		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 <= (-5.4d+17)) then
                  tmp = t_0
              else if (z <= 2d-94) then
                  tmp = x + sin(y)
              else if (z <= 3d+129) 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 <= -5.4e+17) {
          		tmp = t_0;
          	} else if (z <= 2e-94) {
          		tmp = x + Math.sin(y);
          	} else if (z <= 3e+129) {
          		tmp = x + z;
          	} else {
          		tmp = t_0;
          	}
          	return tmp;
          }
          
          def code(x, y, z):
          	t_0 = z * math.cos(y)
          	tmp = 0
          	if z <= -5.4e+17:
          		tmp = t_0
          	elif z <= 2e-94:
          		tmp = x + math.sin(y)
          	elif z <= 3e+129:
          		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 <= -5.4e+17)
          		tmp = t_0;
          	elseif (z <= 2e-94)
          		tmp = Float64(x + sin(y));
          	elseif (z <= 3e+129)
          		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 <= -5.4e+17)
          		tmp = t_0;
          	elseif (z <= 2e-94)
          		tmp = x + sin(y);
          	elseif (z <= 3e+129)
          		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, -5.4e+17], t$95$0, If[LessEqual[z, 2e-94], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3e+129], N[(x + z), $MachinePrecision], t$95$0]]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_0 := z \cdot \cos y\\
          \mathbf{if}\;z \leq -5.4 \cdot 10^{+17}:\\
          \;\;\;\;t\_0\\
          
          \mathbf{elif}\;z \leq 2 \cdot 10^{-94}:\\
          \;\;\;\;x + \sin y\\
          
          \mathbf{elif}\;z \leq 3 \cdot 10^{+129}:\\
          \;\;\;\;x + z\\
          
          \mathbf{else}:\\
          \;\;\;\;t\_0\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 3 regimes
          2. if z < -5.4e17 or 3.0000000000000003e129 < z

            1. Initial program 99.7%

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

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

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

            if -5.4e17 < z < 1.9999999999999999e-94

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

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

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

            if 1.9999999999999999e-94 < z < 3.0000000000000003e129

            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 + z} \]
            4. Step-by-step derivation
              1. +-commutativeN/A

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

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

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

            \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5.4 \cdot 10^{+17}:\\ \;\;\;\;z \cdot \cos y\\ \mathbf{elif}\;z \leq 2 \cdot 10^{-94}:\\ \;\;\;\;x + \sin y\\ \mathbf{elif}\;z \leq 3 \cdot 10^{+129}:\\ \;\;\;\;x + z\\ \mathbf{else}:\\ \;\;\;\;z \cdot \cos y\\ \end{array} \]
          5. Add Preprocessing

          Alternative 6: 88.7% accurate, 1.7× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \cos y\\ \mathbf{if}\;z \leq -1.95 \cdot 10^{+19}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 3 \cdot 10^{+129}:\\ \;\;\;\;1 \cdot z + \left(x + \sin y\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
          (FPCore (x y z)
           :precision binary64
           (let* ((t_0 (* z (cos y))))
             (if (<= z -1.95e+19)
               t_0
               (if (<= z 3e+129) (+ (* 1.0 z) (+ x (sin y))) t_0))))
          double code(double x, double y, double z) {
          	double t_0 = z * cos(y);
          	double tmp;
          	if (z <= -1.95e+19) {
          		tmp = t_0;
          	} else if (z <= 3e+129) {
          		tmp = (1.0 * z) + (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 = z * cos(y)
              if (z <= (-1.95d+19)) then
                  tmp = t_0
              else if (z <= 3d+129) then
                  tmp = (1.0d0 * z) + (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 = z * Math.cos(y);
          	double tmp;
          	if (z <= -1.95e+19) {
          		tmp = t_0;
          	} else if (z <= 3e+129) {
          		tmp = (1.0 * z) + (x + Math.sin(y));
          	} else {
          		tmp = t_0;
          	}
          	return tmp;
          }
          
          def code(x, y, z):
          	t_0 = z * math.cos(y)
          	tmp = 0
          	if z <= -1.95e+19:
          		tmp = t_0
          	elif z <= 3e+129:
          		tmp = (1.0 * z) + (x + math.sin(y))
          	else:
          		tmp = t_0
          	return tmp
          
          function code(x, y, z)
          	t_0 = Float64(z * cos(y))
          	tmp = 0.0
          	if (z <= -1.95e+19)
          		tmp = t_0;
          	elseif (z <= 3e+129)
          		tmp = Float64(Float64(1.0 * z) + Float64(x + sin(y)));
          	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.95e+19)
          		tmp = t_0;
          	elseif (z <= 3e+129)
          		tmp = (1.0 * z) + (x + sin(y));
          	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.95e+19], t$95$0, If[LessEqual[z, 3e+129], N[(N[(1.0 * z), $MachinePrecision] + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_0 := z \cdot \cos y\\
          \mathbf{if}\;z \leq -1.95 \cdot 10^{+19}:\\
          \;\;\;\;t\_0\\
          
          \mathbf{elif}\;z \leq 3 \cdot 10^{+129}:\\
          \;\;\;\;1 \cdot z + \left(x + \sin y\right)\\
          
          \mathbf{else}:\\
          \;\;\;\;t\_0\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if z < -1.95e19 or 3.0000000000000003e129 < z

            1. Initial program 99.7%

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

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

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

            if -1.95e19 < z < 3.0000000000000003e129

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

                \[\leadsto \left(x + \sin y\right) + z \cdot \color{blue}{1} \]
            5. Recombined 2 regimes into one program.
            6. Final simplification91.2%

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

            Alternative 7: 81.9% accurate, 1.8× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} t_0 := x + \sin y\\ \mathbf{if}\;y \leq -48000000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 25500:\\ \;\;\;\;\left(x + y\right) + z\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
            (FPCore (x y z)
             :precision binary64
             (let* ((t_0 (+ x (sin y))))
               (if (<= y -48000000.0) t_0 (if (<= y 25500.0) (+ (+ x y) z) t_0))))
            double code(double x, double y, double z) {
            	double t_0 = x + sin(y);
            	double tmp;
            	if (y <= -48000000.0) {
            		tmp = t_0;
            	} else if (y <= 25500.0) {
            		tmp = (x + y) + z;
            	} else {
            		tmp = t_0;
            	}
            	return tmp;
            }
            
            real(8) function code(x, y, z)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                real(8), intent (in) :: z
                real(8) :: t_0
                real(8) :: tmp
                t_0 = x + sin(y)
                if (y <= (-48000000.0d0)) then
                    tmp = t_0
                else if (y <= 25500.0d0) then
                    tmp = (x + y) + z
                else
                    tmp = t_0
                end if
                code = tmp
            end function
            
            public static double code(double x, double y, double z) {
            	double t_0 = x + Math.sin(y);
            	double tmp;
            	if (y <= -48000000.0) {
            		tmp = t_0;
            	} else if (y <= 25500.0) {
            		tmp = (x + y) + z;
            	} else {
            		tmp = t_0;
            	}
            	return tmp;
            }
            
            def code(x, y, z):
            	t_0 = x + math.sin(y)
            	tmp = 0
            	if y <= -48000000.0:
            		tmp = t_0
            	elif y <= 25500.0:
            		tmp = (x + y) + z
            	else:
            		tmp = t_0
            	return tmp
            
            function code(x, y, z)
            	t_0 = Float64(x + sin(y))
            	tmp = 0.0
            	if (y <= -48000000.0)
            		tmp = t_0;
            	elseif (y <= 25500.0)
            		tmp = Float64(Float64(x + y) + z);
            	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 <= -48000000.0)
            		tmp = t_0;
            	elseif (y <= 25500.0)
            		tmp = (x + y) + z;
            	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, -48000000.0], t$95$0, If[LessEqual[y, 25500.0], N[(N[(x + y), $MachinePrecision] + z), $MachinePrecision], t$95$0]]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            t_0 := x + \sin y\\
            \mathbf{if}\;y \leq -48000000:\\
            \;\;\;\;t\_0\\
            
            \mathbf{elif}\;y \leq 25500:\\
            \;\;\;\;\left(x + y\right) + z\\
            
            \mathbf{else}:\\
            \;\;\;\;t\_0\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if y < -4.8e7 or 25500 < y

              1. Initial program 99.7%

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

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

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

              if -4.8e7 < y < 25500

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

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

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

              \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -48000000:\\ \;\;\;\;x + \sin y\\ \mathbf{elif}\;y \leq 25500:\\ \;\;\;\;\left(x + y\right) + z\\ \mathbf{else}:\\ \;\;\;\;x + \sin y\\ \end{array} \]
            5. Add Preprocessing

            Alternative 8: 71.1% accurate, 6.4× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -22000000:\\ \;\;\;\;x + z\\ \mathbf{elif}\;y \leq 280:\\ \;\;\;\;\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 -22000000.0)
               (+ x z)
               (if (<= y 280.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 <= -22000000.0) {
            		tmp = x + z;
            	} else if (y <= 280.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 <= -22000000.0)
            		tmp = Float64(x + z);
            	elseif (y <= 280.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, -22000000.0], N[(x + z), $MachinePrecision], If[LessEqual[y, 280.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 -22000000:\\
            \;\;\;\;x + z\\
            
            \mathbf{elif}\;y \leq 280:\\
            \;\;\;\;\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 < -2.2e7 or 280 < y

              1. Initial program 99.7%

                \[\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-+.f6437.2

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

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

              if -2.2e7 < y < 280

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

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

                \[\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 simplification68.3%

              \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -22000000:\\ \;\;\;\;x + z\\ \mathbf{elif}\;y \leq 280:\\ \;\;\;\;\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 9: 70.9% accurate, 11.1× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -27000000:\\ \;\;\;\;x + z\\ \mathbf{elif}\;y \leq 1.3 \cdot 10^{+67}:\\ \;\;\;\;\left(x + y\right) + z\\ \mathbf{else}:\\ \;\;\;\;x + z\\ \end{array} \end{array} \]
            (FPCore (x y z)
             :precision binary64
             (if (<= y -27000000.0) (+ x z) (if (<= y 1.3e+67) (+ (+ x y) z) (+ x z))))
            double code(double x, double y, double z) {
            	double tmp;
            	if (y <= -27000000.0) {
            		tmp = x + z;
            	} else if (y <= 1.3e+67) {
            		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 <= (-27000000.0d0)) then
                    tmp = x + z
                else if (y <= 1.3d+67) 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 <= -27000000.0) {
            		tmp = x + z;
            	} else if (y <= 1.3e+67) {
            		tmp = (x + y) + z;
            	} else {
            		tmp = x + z;
            	}
            	return tmp;
            }
            
            def code(x, y, z):
            	tmp = 0
            	if y <= -27000000.0:
            		tmp = x + z
            	elif y <= 1.3e+67:
            		tmp = (x + y) + z
            	else:
            		tmp = x + z
            	return tmp
            
            function code(x, y, z)
            	tmp = 0.0
            	if (y <= -27000000.0)
            		tmp = Float64(x + z);
            	elseif (y <= 1.3e+67)
            		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 <= -27000000.0)
            		tmp = x + z;
            	elseif (y <= 1.3e+67)
            		tmp = (x + y) + z;
            	else
            		tmp = x + z;
            	end
            	tmp_2 = tmp;
            end
            
            code[x_, y_, z_] := If[LessEqual[y, -27000000.0], N[(x + z), $MachinePrecision], If[LessEqual[y, 1.3e+67], N[(N[(x + y), $MachinePrecision] + z), $MachinePrecision], N[(x + z), $MachinePrecision]]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;y \leq -27000000:\\
            \;\;\;\;x + z\\
            
            \mathbf{elif}\;y \leq 1.3 \cdot 10^{+67}:\\
            \;\;\;\;\left(x + y\right) + z\\
            
            \mathbf{else}:\\
            \;\;\;\;x + z\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if y < -2.7e7 or 1.3e67 < y

              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-+.f6436.2

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

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

              if -2.7e7 < y < 1.3e67

              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(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-+.f6494.8

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

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

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

            Alternative 10: 48.9% accurate, 13.2× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.7 \cdot 10^{+149}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;x \leq 1.5 \cdot 10^{-22}:\\ \;\;\;\;z + y\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \end{array} \]
            (FPCore (x y z)
             :precision binary64
             (if (<= x -1.7e+149) (+ x y) (if (<= x 1.5e-22) (+ z y) (+ x y))))
            double code(double x, double y, double z) {
            	double tmp;
            	if (x <= -1.7e+149) {
            		tmp = x + y;
            	} else if (x <= 1.5e-22) {
            		tmp = z + y;
            	} else {
            		tmp = 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) :: tmp
                if (x <= (-1.7d+149)) then
                    tmp = x + y
                else if (x <= 1.5d-22) then
                    tmp = z + y
                else
                    tmp = x + y
                end if
                code = tmp
            end function
            
            public static double code(double x, double y, double z) {
            	double tmp;
            	if (x <= -1.7e+149) {
            		tmp = x + y;
            	} else if (x <= 1.5e-22) {
            		tmp = z + y;
            	} else {
            		tmp = x + y;
            	}
            	return tmp;
            }
            
            def code(x, y, z):
            	tmp = 0
            	if x <= -1.7e+149:
            		tmp = x + y
            	elif x <= 1.5e-22:
            		tmp = z + y
            	else:
            		tmp = x + y
            	return tmp
            
            function code(x, y, z)
            	tmp = 0.0
            	if (x <= -1.7e+149)
            		tmp = Float64(x + y);
            	elseif (x <= 1.5e-22)
            		tmp = Float64(z + y);
            	else
            		tmp = Float64(x + y);
            	end
            	return tmp
            end
            
            function tmp_2 = code(x, y, z)
            	tmp = 0.0;
            	if (x <= -1.7e+149)
            		tmp = x + y;
            	elseif (x <= 1.5e-22)
            		tmp = z + y;
            	else
            		tmp = x + y;
            	end
            	tmp_2 = tmp;
            end
            
            code[x_, y_, z_] := If[LessEqual[x, -1.7e+149], N[(x + y), $MachinePrecision], If[LessEqual[x, 1.5e-22], N[(z + y), $MachinePrecision], N[(x + y), $MachinePrecision]]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;x \leq -1.7 \cdot 10^{+149}:\\
            \;\;\;\;x + y\\
            
            \mathbf{elif}\;x \leq 1.5 \cdot 10^{-22}:\\
            \;\;\;\;z + y\\
            
            \mathbf{else}:\\
            \;\;\;\;x + y\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if x < -1.6999999999999999e149 or 1.5e-22 < x

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

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

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

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

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

                if -1.6999999999999999e149 < x < 1.5e-22

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

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

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

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

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

                  \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.7 \cdot 10^{+149}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;x \leq 1.5 \cdot 10^{-22}:\\ \;\;\;\;z + y\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
                10. Add Preprocessing

                Alternative 11: 38.4% 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 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.f6456.1

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

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

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

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

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

                  Reproduce

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