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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 80.6% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \cos y + \left(\sin y + x\right)\\ \mathbf{if}\;t\_0 \leq -5 \cdot 10^{+16}:\\ \;\;\;\;x + z\\ \mathbf{elif}\;t\_0 \leq -0.02:\\ \;\;\;\;\sin y\\ \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-20}:\\ \;\;\;\;\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)) (+ (sin y) x))))
   (if (<= t_0 -5e+16)
     (+ x z)
     (if (<= t_0 -0.02)
       (sin y)
       (if (<= t_0 5e-20) (+ (+ 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)) + (sin(y) + x);
	double tmp;
	if (t_0 <= -5e+16) {
		tmp = x + z;
	} else if (t_0 <= -0.02) {
		tmp = sin(y);
	} else if (t_0 <= 5e-20) {
		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)) + (sin(y) + x)
    if (t_0 <= (-5d+16)) then
        tmp = x + z
    else if (t_0 <= (-0.02d0)) then
        tmp = sin(y)
    else if (t_0 <= 5d-20) 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)) + (Math.sin(y) + x);
	double tmp;
	if (t_0 <= -5e+16) {
		tmp = x + z;
	} else if (t_0 <= -0.02) {
		tmp = Math.sin(y);
	} else if (t_0 <= 5e-20) {
		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)) + (math.sin(y) + x)
	tmp = 0
	if t_0 <= -5e+16:
		tmp = x + z
	elif t_0 <= -0.02:
		tmp = math.sin(y)
	elif t_0 <= 5e-20:
		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(sin(y) + x))
	tmp = 0.0
	if (t_0 <= -5e+16)
		tmp = Float64(x + z);
	elseif (t_0 <= -0.02)
		tmp = sin(y);
	elseif (t_0 <= 5e-20)
		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)) + (sin(y) + x);
	tmp = 0.0;
	if (t_0 <= -5e+16)
		tmp = x + z;
	elseif (t_0 <= -0.02)
		tmp = sin(y);
	elseif (t_0 <= 5e-20)
		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[(N[Sin[y], $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e+16], N[(x + z), $MachinePrecision], If[LessEqual[t$95$0, -0.02], N[Sin[y], $MachinePrecision], If[LessEqual[t$95$0, 5e-20], 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(\sin y + x\right)\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{+16}:\\
\;\;\;\;x + z\\

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

\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-20}:\\
\;\;\;\;\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))) < -5e16 or 1 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y)))

    1. Initial program 99.9%

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

      \[\leadsto \color{blue}{x + z} \]
    4. Step-by-step derivation
      1. lower-+.f6481.5

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

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

    if -5e16 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < -0.0200000000000000004 or 4.9999999999999999e-20 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 1

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sin y + z \cdot \cos y} \]
    6. 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.f6493.6

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

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

      \[\leadsto \sin y \]
    9. Step-by-step derivation
      1. Applied rewrites91.4%

        \[\leadsto \sin y \]

      if -0.0200000000000000004 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 4.9999999999999999e-20

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

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

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

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

    Alternative 3: 70.5% accurate, 0.5× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \cos y + \left(\sin y + x\right)\\ \mathbf{if}\;t\_0 \leq -0.1:\\ \;\;\;\;x + z\\ \mathbf{elif}\;t\_0 \leq 0.15:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.008333333333333333, y \cdot y, -0.16666666666666666\right), y \cdot y, 1\right) \cdot y + \left(x + z\right)\\ \mathbf{else}:\\ \;\;\;\;x + z\\ \end{array} \end{array} \]
    (FPCore (x y z)
     :precision binary64
     (let* ((t_0 (+ (* z (cos y)) (+ (sin y) x))))
       (if (<= t_0 -0.1)
         (+ x z)
         (if (<= t_0 0.15)
           (+
            (*
             (fma
              (fma 0.008333333333333333 (* y y) -0.16666666666666666)
              (* y y)
              1.0)
             y)
            (+ x z))
           (+ x z)))))
    double code(double x, double y, double z) {
    	double t_0 = (z * cos(y)) + (sin(y) + x);
    	double tmp;
    	if (t_0 <= -0.1) {
    		tmp = x + z;
    	} else if (t_0 <= 0.15) {
    		tmp = (fma(fma(0.008333333333333333, (y * y), -0.16666666666666666), (y * y), 1.0) * y) + (x + z);
    	} else {
    		tmp = x + z;
    	}
    	return tmp;
    }
    
    function code(x, y, z)
    	t_0 = Float64(Float64(z * cos(y)) + Float64(sin(y) + x))
    	tmp = 0.0
    	if (t_0 <= -0.1)
    		tmp = Float64(x + z);
    	elseif (t_0 <= 0.15)
    		tmp = Float64(Float64(fma(fma(0.008333333333333333, Float64(y * y), -0.16666666666666666), Float64(y * y), 1.0) * y) + Float64(x + z));
    	else
    		tmp = Float64(x + z);
    	end
    	return tmp
    end
    
    code[x_, y_, z_] := Block[{t$95$0 = N[(N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision] + N[(N[Sin[y], $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -0.1], N[(x + z), $MachinePrecision], If[LessEqual[t$95$0, 0.15], N[(N[(N[(N[(0.008333333333333333 * N[(y * y), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision] * y), $MachinePrecision] + N[(x + z), $MachinePrecision]), $MachinePrecision], N[(x + z), $MachinePrecision]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := z \cdot \cos y + \left(\sin y + x\right)\\
    \mathbf{if}\;t\_0 \leq -0.1:\\
    \;\;\;\;x + z\\
    
    \mathbf{elif}\;t\_0 \leq 0.15:\\
    \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.008333333333333333, y \cdot y, -0.16666666666666666\right), y \cdot y, 1\right) \cdot y + \left(x + z\right)\\
    
    \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))) < -0.10000000000000001 or 0.149999999999999994 < (+.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. lower-+.f6468.8

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

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

      if -0.10000000000000001 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 0.149999999999999994

      1. Initial program 100.0%

        \[\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. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 4: 70.4% accurate, 0.5× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \cos y + \left(\sin y + x\right)\\ \mathbf{if}\;t\_0 \leq -0.5:\\ \;\;\;\;x + z\\ \mathbf{elif}\;t\_0 \leq 0.15:\\ \;\;\;\;\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
     (let* ((t_0 (+ (* z (cos y)) (+ (sin y) x))))
       (if (<= t_0 -0.5)
         (+ x z)
         (if (<= t_0 0.15) (fma (fma (* -0.5 y) z 1.0) y (+ x z)) (+ x z)))))
    double code(double x, double y, double z) {
    	double t_0 = (z * cos(y)) + (sin(y) + x);
    	double tmp;
    	if (t_0 <= -0.5) {
    		tmp = x + z;
    	} else if (t_0 <= 0.15) {
    		tmp = fma(fma((-0.5 * y), z, 1.0), y, (x + z));
    	} else {
    		tmp = x + z;
    	}
    	return tmp;
    }
    
    function code(x, y, z)
    	t_0 = Float64(Float64(z * cos(y)) + Float64(sin(y) + x))
    	tmp = 0.0
    	if (t_0 <= -0.5)
    		tmp = Float64(x + z);
    	elseif (t_0 <= 0.15)
    		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_] := Block[{t$95$0 = N[(N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision] + N[(N[Sin[y], $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -0.5], N[(x + z), $MachinePrecision], If[LessEqual[t$95$0, 0.15], 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}
    t_0 := z \cdot \cos y + \left(\sin y + x\right)\\
    \mathbf{if}\;t\_0 \leq -0.5:\\
    \;\;\;\;x + z\\
    
    \mathbf{elif}\;t\_0 \leq 0.15:\\
    \;\;\;\;\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 (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < -0.5 or 0.149999999999999994 < (+.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. lower-+.f6470.6

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

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

      if -0.5 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 0.149999999999999994

      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 + \color{blue}{\left(y \cdot z\right) \cdot \frac{-1}{2}}\right) \cdot y + \left(x + z\right) \]
        5. associate-*r*N/A

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\frac{-1}{2} \cdot y\right) \cdot z} + 1, y, x + z\right) \]
        13. 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) \]
        14. lower-*.f64N/A

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

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

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

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

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \cos y + \left(\sin y + x\right)\\ \mathbf{if}\;t\_0 \leq -0.16:\\ \;\;\;\;x + z\\ \mathbf{elif}\;t\_0 \leq 0.15:\\ \;\;\;\;\left(x + y\right) + z\\ \mathbf{else}:\\ \;\;\;\;x + z\\ \end{array} \end{array} \]
    (FPCore (x y z)
     :precision binary64
     (let* ((t_0 (+ (* z (cos y)) (+ (sin y) x))))
       (if (<= t_0 -0.16) (+ x z) (if (<= t_0 0.15) (+ (+ x y) z) (+ x z)))))
    double code(double x, double y, double z) {
    	double t_0 = (z * cos(y)) + (sin(y) + x);
    	double tmp;
    	if (t_0 <= -0.16) {
    		tmp = x + z;
    	} else if (t_0 <= 0.15) {
    		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) :: t_0
        real(8) :: tmp
        t_0 = (z * cos(y)) + (sin(y) + x)
        if (t_0 <= (-0.16d0)) then
            tmp = x + z
        else if (t_0 <= 0.15d0) 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 t_0 = (z * Math.cos(y)) + (Math.sin(y) + x);
    	double tmp;
    	if (t_0 <= -0.16) {
    		tmp = x + z;
    	} else if (t_0 <= 0.15) {
    		tmp = (x + y) + z;
    	} else {
    		tmp = x + z;
    	}
    	return tmp;
    }
    
    def code(x, y, z):
    	t_0 = (z * math.cos(y)) + (math.sin(y) + x)
    	tmp = 0
    	if t_0 <= -0.16:
    		tmp = x + z
    	elif t_0 <= 0.15:
    		tmp = (x + y) + z
    	else:
    		tmp = x + z
    	return tmp
    
    function code(x, y, z)
    	t_0 = Float64(Float64(z * cos(y)) + Float64(sin(y) + x))
    	tmp = 0.0
    	if (t_0 <= -0.16)
    		tmp = Float64(x + z);
    	elseif (t_0 <= 0.15)
    		tmp = Float64(Float64(x + y) + z);
    	else
    		tmp = Float64(x + z);
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y, z)
    	t_0 = (z * cos(y)) + (sin(y) + x);
    	tmp = 0.0;
    	if (t_0 <= -0.16)
    		tmp = x + z;
    	elseif (t_0 <= 0.15)
    		tmp = (x + y) + z;
    	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[(N[Sin[y], $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -0.16], N[(x + z), $MachinePrecision], If[LessEqual[t$95$0, 0.15], N[(N[(x + y), $MachinePrecision] + z), $MachinePrecision], N[(x + z), $MachinePrecision]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := z \cdot \cos y + \left(\sin y + x\right)\\
    \mathbf{if}\;t\_0 \leq -0.16:\\
    \;\;\;\;x + z\\
    
    \mathbf{elif}\;t\_0 \leq 0.15:\\
    \;\;\;\;\left(x + y\right) + z\\
    
    \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))) < -0.160000000000000003 or 0.149999999999999994 < (+.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. lower-+.f6469.1

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

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

      if -0.160000000000000003 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 0.149999999999999994

      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. lower-+.f6489.5

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

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

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

    Alternative 6: 84.3% accurate, 1.6× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \cos y\\ \mathbf{if}\;z \leq -1 \cdot 10^{+207}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -1.32 \cdot 10^{-33}:\\ \;\;\;\;x + z\\ \mathbf{elif}\;z \leq 1.35 \cdot 10^{-28}:\\ \;\;\;\;\sin y + x\\ \mathbf{elif}\;z \leq 8.2 \cdot 10^{+151}:\\ \;\;\;\;x + z\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
    (FPCore (x y z)
     :precision binary64
     (let* ((t_0 (* z (cos y))))
       (if (<= z -1e+207)
         t_0
         (if (<= z -1.32e-33)
           (+ x z)
           (if (<= z 1.35e-28) (+ (sin y) x) (if (<= z 8.2e+151) (+ x z) t_0))))))
    double code(double x, double y, double z) {
    	double t_0 = z * cos(y);
    	double tmp;
    	if (z <= -1e+207) {
    		tmp = t_0;
    	} else if (z <= -1.32e-33) {
    		tmp = x + z;
    	} else if (z <= 1.35e-28) {
    		tmp = sin(y) + x;
    	} else if (z <= 8.2e+151) {
    		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 <= (-1d+207)) then
            tmp = t_0
        else if (z <= (-1.32d-33)) then
            tmp = x + z
        else if (z <= 1.35d-28) then
            tmp = sin(y) + x
        else if (z <= 8.2d+151) 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 <= -1e+207) {
    		tmp = t_0;
    	} else if (z <= -1.32e-33) {
    		tmp = x + z;
    	} else if (z <= 1.35e-28) {
    		tmp = Math.sin(y) + x;
    	} else if (z <= 8.2e+151) {
    		tmp = x + z;
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    def code(x, y, z):
    	t_0 = z * math.cos(y)
    	tmp = 0
    	if z <= -1e+207:
    		tmp = t_0
    	elif z <= -1.32e-33:
    		tmp = x + z
    	elif z <= 1.35e-28:
    		tmp = math.sin(y) + x
    	elif z <= 8.2e+151:
    		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 <= -1e+207)
    		tmp = t_0;
    	elseif (z <= -1.32e-33)
    		tmp = Float64(x + z);
    	elseif (z <= 1.35e-28)
    		tmp = Float64(sin(y) + x);
    	elseif (z <= 8.2e+151)
    		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 <= -1e+207)
    		tmp = t_0;
    	elseif (z <= -1.32e-33)
    		tmp = x + z;
    	elseif (z <= 1.35e-28)
    		tmp = sin(y) + x;
    	elseif (z <= 8.2e+151)
    		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, -1e+207], t$95$0, If[LessEqual[z, -1.32e-33], N[(x + z), $MachinePrecision], If[LessEqual[z, 1.35e-28], N[(N[Sin[y], $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 8.2e+151], N[(x + z), $MachinePrecision], t$95$0]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := z \cdot \cos y\\
    \mathbf{if}\;z \leq -1 \cdot 10^{+207}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;z \leq -1.32 \cdot 10^{-33}:\\
    \;\;\;\;x + z\\
    
    \mathbf{elif}\;z \leq 1.35 \cdot 10^{-28}:\\
    \;\;\;\;\sin y + x\\
    
    \mathbf{elif}\;z \leq 8.2 \cdot 10^{+151}:\\
    \;\;\;\;x + z\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if z < -1e207 or 8.1999999999999996e151 < 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. *-commutativeN/A

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

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

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

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

      if -1e207 < z < -1.31999999999999993e-33 or 1.3499999999999999e-28 < z < 8.1999999999999996e151

      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. lower-+.f6483.4

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

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

      if -1.31999999999999993e-33 < z < 1.3499999999999999e-28

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

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1 \cdot 10^{+207}:\\ \;\;\;\;z \cdot \cos y\\ \mathbf{elif}\;z \leq -1.32 \cdot 10^{-33}:\\ \;\;\;\;x + z\\ \mathbf{elif}\;z \leq 1.35 \cdot 10^{-28}:\\ \;\;\;\;\sin y + x\\ \mathbf{elif}\;z \leq 8.2 \cdot 10^{+151}:\\ \;\;\;\;x + z\\ \mathbf{else}:\\ \;\;\;\;z \cdot \cos y\\ \end{array} \]
    5. Add Preprocessing

    Alternative 7: 88.6% accurate, 1.8× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \cos y\\ \mathbf{if}\;z \leq -1 \cdot 10^{+207}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 8.2 \cdot 10^{+151}:\\ \;\;\;\;\left(x + z\right) + \sin y\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
    (FPCore (x y z)
     :precision binary64
     (let* ((t_0 (* z (cos y))))
       (if (<= z -1e+207) t_0 (if (<= z 8.2e+151) (+ (+ x z) (sin y)) t_0))))
    double code(double x, double y, double z) {
    	double t_0 = z * cos(y);
    	double tmp;
    	if (z <= -1e+207) {
    		tmp = t_0;
    	} else if (z <= 8.2e+151) {
    		tmp = (x + z) + 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 <= (-1d+207)) then
            tmp = t_0
        else if (z <= 8.2d+151) then
            tmp = (x + z) + 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 <= -1e+207) {
    		tmp = t_0;
    	} else if (z <= 8.2e+151) {
    		tmp = (x + z) + Math.sin(y);
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    def code(x, y, z):
    	t_0 = z * math.cos(y)
    	tmp = 0
    	if z <= -1e+207:
    		tmp = t_0
    	elif z <= 8.2e+151:
    		tmp = (x + z) + 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 <= -1e+207)
    		tmp = t_0;
    	elseif (z <= 8.2e+151)
    		tmp = Float64(Float64(x + z) + 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 <= -1e+207)
    		tmp = t_0;
    	elseif (z <= 8.2e+151)
    		tmp = (x + z) + 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, -1e+207], t$95$0, If[LessEqual[z, 8.2e+151], N[(N[(x + z), $MachinePrecision] + N[Sin[y], $MachinePrecision]), $MachinePrecision], t$95$0]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := z \cdot \cos y\\
    \mathbf{if}\;z \leq -1 \cdot 10^{+207}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;z \leq 8.2 \cdot 10^{+151}:\\
    \;\;\;\;\left(x + z\right) + \sin y\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if z < -1e207 or 8.1999999999999996e151 < 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. *-commutativeN/A

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

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

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

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

      if -1e207 < z < 8.1999999999999996e151

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 8: 80.7% accurate, 1.8× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin y + x\\ \mathbf{if}\;y \leq -6 \cdot 10^{+26}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 55000000:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.008333333333333333, y \cdot y, -0.16666666666666666\right), y \cdot y, 1\right) \cdot y + \left(x + z\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
    (FPCore (x y z)
     :precision binary64
     (let* ((t_0 (+ (sin y) x)))
       (if (<= y -6e+26)
         t_0
         (if (<= y 55000000.0)
           (+
            (*
             (fma
              (fma 0.008333333333333333 (* y y) -0.16666666666666666)
              (* y y)
              1.0)
             y)
            (+ x z))
           t_0))))
    double code(double x, double y, double z) {
    	double t_0 = sin(y) + x;
    	double tmp;
    	if (y <= -6e+26) {
    		tmp = t_0;
    	} else if (y <= 55000000.0) {
    		tmp = (fma(fma(0.008333333333333333, (y * y), -0.16666666666666666), (y * y), 1.0) * y) + (x + z);
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    function code(x, y, z)
    	t_0 = Float64(sin(y) + x)
    	tmp = 0.0
    	if (y <= -6e+26)
    		tmp = t_0;
    	elseif (y <= 55000000.0)
    		tmp = Float64(Float64(fma(fma(0.008333333333333333, Float64(y * y), -0.16666666666666666), Float64(y * y), 1.0) * y) + Float64(x + z));
    	else
    		tmp = t_0;
    	end
    	return tmp
    end
    
    code[x_, y_, z_] := Block[{t$95$0 = N[(N[Sin[y], $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[y, -6e+26], t$95$0, If[LessEqual[y, 55000000.0], N[(N[(N[(N[(0.008333333333333333 * N[(y * y), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision] * y), $MachinePrecision] + N[(x + z), $MachinePrecision]), $MachinePrecision], t$95$0]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \sin y + x\\
    \mathbf{if}\;y \leq -6 \cdot 10^{+26}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;y \leq 55000000:\\
    \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.008333333333333333, y \cdot y, -0.16666666666666666\right), y \cdot y, 1\right) \cdot y + \left(x + z\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if y < -5.99999999999999994e26 or 5.5e7 < 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. lower-+.f64N/A

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

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

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

      if -5.99999999999999994e26 < y < 5.5e7

      1. Initial program 100.0%

        \[\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. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 9: 70.5% accurate, 3.7× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -4200000000:\\ \;\;\;\;x + z\\ \mathbf{elif}\;y \leq 4.8 \cdot 10^{+18}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.0001984126984126984, y \cdot y, 0.008333333333333333\right), y \cdot y, -0.16666666666666666\right), y \cdot y, 1\right) \cdot y + \left(x + z\right)\\ \mathbf{else}:\\ \;\;\;\;x + z\\ \end{array} \end{array} \]
    (FPCore (x y z)
     :precision binary64
     (if (<= y -4200000000.0)
       (+ x z)
       (if (<= y 4.8e+18)
         (+
          (*
           (fma
            (fma
             (fma -0.0001984126984126984 (* y y) 0.008333333333333333)
             (* y y)
             -0.16666666666666666)
            (* y y)
            1.0)
           y)
          (+ x z))
         (+ x z))))
    double code(double x, double y, double z) {
    	double tmp;
    	if (y <= -4200000000.0) {
    		tmp = x + z;
    	} else if (y <= 4.8e+18) {
    		tmp = (fma(fma(fma(-0.0001984126984126984, (y * y), 0.008333333333333333), (y * y), -0.16666666666666666), (y * y), 1.0) * y) + (x + z);
    	} else {
    		tmp = x + z;
    	}
    	return tmp;
    }
    
    function code(x, y, z)
    	tmp = 0.0
    	if (y <= -4200000000.0)
    		tmp = Float64(x + z);
    	elseif (y <= 4.8e+18)
    		tmp = Float64(Float64(fma(fma(fma(-0.0001984126984126984, Float64(y * y), 0.008333333333333333), Float64(y * y), -0.16666666666666666), Float64(y * y), 1.0) * y) + Float64(x + z));
    	else
    		tmp = Float64(x + z);
    	end
    	return tmp
    end
    
    code[x_, y_, z_] := If[LessEqual[y, -4200000000.0], N[(x + z), $MachinePrecision], If[LessEqual[y, 4.8e+18], N[(N[(N[(N[(N[(-0.0001984126984126984 * N[(y * y), $MachinePrecision] + 0.008333333333333333), $MachinePrecision] * N[(y * y), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision] * y), $MachinePrecision] + N[(x + z), $MachinePrecision]), $MachinePrecision], N[(x + z), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;y \leq -4200000000:\\
    \;\;\;\;x + z\\
    
    \mathbf{elif}\;y \leq 4.8 \cdot 10^{+18}:\\
    \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.0001984126984126984, y \cdot y, 0.008333333333333333\right), y \cdot y, -0.16666666666666666\right), y \cdot y, 1\right) \cdot y + \left(x + z\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;x + z\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if y < -4.2e9 or 4.8e18 < 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. lower-+.f6443.1

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

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

      if -4.2e9 < y < 4.8e18

      1. Initial program 100.0%

        \[\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. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 10: 70.1% accurate, 5.4× speedup?

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

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

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

      if -4.6e5 < y < 7.49999999999999989e-25

      1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 11: 66.8% accurate, 53.0× speedup?

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

      \[\leadsto \color{blue}{x + z} \]
    4. Step-by-step derivation
      1. lower-+.f6467.9

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

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

    Reproduce

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