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

Percentage Accurate: 99.9% → 99.9%
Time: 10.6s
Alternatives: 12
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 12 alternatives:

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

Initial Program: 99.9% accurate, 1.0× speedup?

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

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

Alternative 1: 99.9% accurate, 1.0× speedup?

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

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

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

Alternative 2: 98.8% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x + \cos y\\ t_1 := z \cdot \sin y\\ t_2 := t\_0 - t\_1\\ t_3 := \left(x + 1\right) - t\_1\\ \mathbf{if}\;t\_2 \leq -150000:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;t\_2 \leq 0.995:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_3\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (+ x (cos y)))
        (t_1 (* z (sin y)))
        (t_2 (- t_0 t_1))
        (t_3 (- (+ x 1.0) t_1)))
   (if (<= t_2 -150000.0) t_3 (if (<= t_2 0.995) t_0 t_3))))
double code(double x, double y, double z) {
	double t_0 = x + cos(y);
	double t_1 = z * sin(y);
	double t_2 = t_0 - t_1;
	double t_3 = (x + 1.0) - t_1;
	double tmp;
	if (t_2 <= -150000.0) {
		tmp = t_3;
	} else if (t_2 <= 0.995) {
		tmp = t_0;
	} else {
		tmp = t_3;
	}
	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) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_0 = x + cos(y)
    t_1 = z * sin(y)
    t_2 = t_0 - t_1
    t_3 = (x + 1.0d0) - t_1
    if (t_2 <= (-150000.0d0)) then
        tmp = t_3
    else if (t_2 <= 0.995d0) then
        tmp = t_0
    else
        tmp = t_3
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = x + Math.cos(y);
	double t_1 = z * Math.sin(y);
	double t_2 = t_0 - t_1;
	double t_3 = (x + 1.0) - t_1;
	double tmp;
	if (t_2 <= -150000.0) {
		tmp = t_3;
	} else if (t_2 <= 0.995) {
		tmp = t_0;
	} else {
		tmp = t_3;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x + math.cos(y)
	t_1 = z * math.sin(y)
	t_2 = t_0 - t_1
	t_3 = (x + 1.0) - t_1
	tmp = 0
	if t_2 <= -150000.0:
		tmp = t_3
	elif t_2 <= 0.995:
		tmp = t_0
	else:
		tmp = t_3
	return tmp
function code(x, y, z)
	t_0 = Float64(x + cos(y))
	t_1 = Float64(z * sin(y))
	t_2 = Float64(t_0 - t_1)
	t_3 = Float64(Float64(x + 1.0) - t_1)
	tmp = 0.0
	if (t_2 <= -150000.0)
		tmp = t_3;
	elseif (t_2 <= 0.995)
		tmp = t_0;
	else
		tmp = t_3;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x + cos(y);
	t_1 = z * sin(y);
	t_2 = t_0 - t_1;
	t_3 = (x + 1.0) - t_1;
	tmp = 0.0;
	if (t_2 <= -150000.0)
		tmp = t_3;
	elseif (t_2 <= 0.995)
		tmp = t_0;
	else
		tmp = t_3;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 - t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(x + 1.0), $MachinePrecision] - t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, -150000.0], t$95$3, If[LessEqual[t$95$2, 0.995], t$95$0, t$95$3]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x + \cos y\\
t_1 := z \cdot \sin y\\
t_2 := t\_0 - t\_1\\
t_3 := \left(x + 1\right) - t\_1\\
\mathbf{if}\;t\_2 \leq -150000:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;t\_2 \leq 0.995:\\
\;\;\;\;t\_0\\

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


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

    1. Initial program 99.9%

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

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

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

      if -1.5e5 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < 0.994999999999999996

      1. Initial program 99.9%

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

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

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

          \[\leadsto \color{blue}{\cos y + x} \]
        3. lower-cos.f6498.0

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

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

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

    Alternative 3: 98.3% accurate, 0.4× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := x + \cos y\\ t_1 := t\_0 - z \cdot \sin y\\ t_2 := \mathsf{fma}\left(z, -\sin y, x\right)\\ \mathbf{if}\;t\_1 \leq -150000:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_1 \leq 2:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
    (FPCore (x y z)
     :precision binary64
     (let* ((t_0 (+ x (cos y)))
            (t_1 (- t_0 (* z (sin y))))
            (t_2 (fma z (- (sin y)) x)))
       (if (<= t_1 -150000.0) t_2 (if (<= t_1 2.0) t_0 t_2))))
    double code(double x, double y, double z) {
    	double t_0 = x + cos(y);
    	double t_1 = t_0 - (z * sin(y));
    	double t_2 = fma(z, -sin(y), x);
    	double tmp;
    	if (t_1 <= -150000.0) {
    		tmp = t_2;
    	} else if (t_1 <= 2.0) {
    		tmp = t_0;
    	} else {
    		tmp = t_2;
    	}
    	return tmp;
    }
    
    function code(x, y, z)
    	t_0 = Float64(x + cos(y))
    	t_1 = Float64(t_0 - Float64(z * sin(y)))
    	t_2 = fma(z, Float64(-sin(y)), x)
    	tmp = 0.0
    	if (t_1 <= -150000.0)
    		tmp = t_2;
    	elseif (t_1 <= 2.0)
    		tmp = t_0;
    	else
    		tmp = t_2;
    	end
    	return tmp
    end
    
    code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(z * (-N[Sin[y], $MachinePrecision]) + x), $MachinePrecision]}, If[LessEqual[t$95$1, -150000.0], t$95$2, If[LessEqual[t$95$1, 2.0], t$95$0, t$95$2]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := x + \cos y\\
    t_1 := t\_0 - z \cdot \sin y\\
    t_2 := \mathsf{fma}\left(z, -\sin y, x\right)\\
    \mathbf{if}\;t\_1 \leq -150000:\\
    \;\;\;\;t\_2\\
    
    \mathbf{elif}\;t\_1 \leq 2:\\
    \;\;\;\;t\_0\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_2\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < -1.5e5 or 2 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y)))

      1. Initial program 99.9%

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

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

          \[\leadsto \color{blue}{x + 1} \]
        2. lower-+.f6461.0

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

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

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

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

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

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

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

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

          \[\leadsto z \cdot \left(\left(\frac{x}{z} + \frac{\color{blue}{\cos y}}{z}\right) - \sin y\right) \]
        7. lower-sin.f6486.9

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

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

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

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

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

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

          if -1.5e5 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < 2

          1. Initial program 100.0%

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

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

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

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

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

            \[\leadsto \color{blue}{\cos y + x} \]
        4. Recombined 2 regimes into one program.
        5. Final simplification98.0%

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

        Alternative 4: 98.5% accurate, 1.0× speedup?

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

          1. Initial program 100.0%

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

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

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

            if -1.4500000000000001e-8 < x < 6.00000000000000018e-54

            1. Initial program 99.8%

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

              \[\leadsto \color{blue}{\cos y} - z \cdot \sin y \]
            4. Step-by-step derivation
              1. lower-cos.f6499.3

                \[\leadsto \color{blue}{\cos y} - z \cdot \sin y \]
            5. Applied rewrites99.3%

              \[\leadsto \color{blue}{\cos y} - z \cdot \sin y \]
          5. Recombined 2 regimes into one program.
          6. Add Preprocessing

          Alternative 5: 80.3% accurate, 1.8× speedup?

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

            1. Initial program 99.8%

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

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

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

                \[\leadsto \color{blue}{\cos y + x} \]
              3. lower-cos.f6468.7

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

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

            if -1.6499999999999999 < y < 1.15e14

            1. Initial program 100.0%

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

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

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

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

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

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

                  \[\leadsto \left(x + 1\right) - y \cdot \color{blue}{\mathsf{fma}\left({y}^{2}, \frac{-1}{6} \cdot z + {y}^{2} \cdot \left(\frac{-1}{5040} \cdot \left({y}^{2} \cdot z\right) + \frac{1}{120} \cdot z\right), z\right)} \]
              4. Applied rewrites99.3%

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

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

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

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

                  \[\leadsto \left(x + 1\right) - y \cdot \color{blue}{\mathsf{fma}\left({y}^{2}, \frac{-1}{6} \cdot z + {y}^{2} \cdot \left(\frac{-1}{5040} \cdot \left({y}^{2} \cdot z\right) + \frac{1}{120} \cdot z\right), z\right)} \]
              7. Applied rewrites99.3%

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

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

            Alternative 6: 69.7% accurate, 3.4× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -34000000:\\ \;\;\;\;x + 1\\ \mathbf{elif}\;y \leq 5.8 \cdot 10^{+14}:\\ \;\;\;\;\left(x + 1\right) - y \cdot \mathsf{fma}\left(y \cdot y, z \cdot \mathsf{fma}\left(y, y \cdot \mathsf{fma}\left(y \cdot y, -0.0001984126984126984, 0.008333333333333333\right), -0.16666666666666666\right), z\right)\\ \mathbf{else}:\\ \;\;\;\;x + 1\\ \end{array} \end{array} \]
            (FPCore (x y z)
             :precision binary64
             (if (<= y -34000000.0)
               (+ x 1.0)
               (if (<= y 5.8e+14)
                 (-
                  (+ x 1.0)
                  (*
                   y
                   (fma
                    (* y y)
                    (*
                     z
                     (fma
                      y
                      (* y (fma (* y y) -0.0001984126984126984 0.008333333333333333))
                      -0.16666666666666666))
                    z)))
                 (+ x 1.0))))
            double code(double x, double y, double z) {
            	double tmp;
            	if (y <= -34000000.0) {
            		tmp = x + 1.0;
            	} else if (y <= 5.8e+14) {
            		tmp = (x + 1.0) - (y * fma((y * y), (z * fma(y, (y * fma((y * y), -0.0001984126984126984, 0.008333333333333333)), -0.16666666666666666)), z));
            	} else {
            		tmp = x + 1.0;
            	}
            	return tmp;
            }
            
            function code(x, y, z)
            	tmp = 0.0
            	if (y <= -34000000.0)
            		tmp = Float64(x + 1.0);
            	elseif (y <= 5.8e+14)
            		tmp = Float64(Float64(x + 1.0) - Float64(y * fma(Float64(y * y), Float64(z * fma(y, Float64(y * fma(Float64(y * y), -0.0001984126984126984, 0.008333333333333333)), -0.16666666666666666)), z)));
            	else
            		tmp = Float64(x + 1.0);
            	end
            	return tmp
            end
            
            code[x_, y_, z_] := If[LessEqual[y, -34000000.0], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 5.8e+14], N[(N[(x + 1.0), $MachinePrecision] - N[(y * N[(N[(y * y), $MachinePrecision] * N[(z * N[(y * N[(y * N[(N[(y * y), $MachinePrecision] * -0.0001984126984126984 + 0.008333333333333333), $MachinePrecision]), $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;y \leq -34000000:\\
            \;\;\;\;x + 1\\
            
            \mathbf{elif}\;y \leq 5.8 \cdot 10^{+14}:\\
            \;\;\;\;\left(x + 1\right) - y \cdot \mathsf{fma}\left(y \cdot y, z \cdot \mathsf{fma}\left(y, y \cdot \mathsf{fma}\left(y \cdot y, -0.0001984126984126984, 0.008333333333333333\right), -0.16666666666666666\right), z\right)\\
            
            \mathbf{else}:\\
            \;\;\;\;x + 1\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if y < -3.4e7 or 5.8e14 < y

              1. Initial program 99.8%

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

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

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

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

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

              if -3.4e7 < y < 5.8e14

              1. Initial program 100.0%

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

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

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

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

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

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

                    \[\leadsto \left(x + 1\right) - y \cdot \color{blue}{\mathsf{fma}\left({y}^{2}, \frac{-1}{6} \cdot z + {y}^{2} \cdot \left(\frac{-1}{5040} \cdot \left({y}^{2} \cdot z\right) + \frac{1}{120} \cdot z\right), z\right)} \]
                4. Applied rewrites98.6%

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

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

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

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

                    \[\leadsto \left(x + 1\right) - y \cdot \color{blue}{\mathsf{fma}\left({y}^{2}, \frac{-1}{6} \cdot z + {y}^{2} \cdot \left(\frac{-1}{5040} \cdot \left({y}^{2} \cdot z\right) + \frac{1}{120} \cdot z\right), z\right)} \]
                7. Applied rewrites98.6%

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

              Alternative 7: 69.4% accurate, 4.2× speedup?

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

                1. Initial program 99.8%

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

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

                    \[\leadsto \color{blue}{x + 1} \]
                  2. lower-+.f6441.8

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

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

                if -1.7e14 < y < 1.04999999999999997e45

                1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                Alternative 8: 69.7% accurate, 5.2× speedup?

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

                  1. Initial program 99.8%

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

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

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

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

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

                  if -3.2e6 < y < 1.75e14

                  1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                Alternative 9: 69.2% accurate, 9.6× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -5 \cdot 10^{+41}:\\ \;\;\;\;x + 1\\ \mathbf{elif}\;y \leq 4.7 \cdot 10^{+114}:\\ \;\;\;\;x - \mathsf{fma}\left(y, z, -1\right)\\ \mathbf{else}:\\ \;\;\;\;x + 1\\ \end{array} \end{array} \]
                (FPCore (x y z)
                 :precision binary64
                 (if (<= y -5e+41)
                   (+ x 1.0)
                   (if (<= y 4.7e+114) (- x (fma y z -1.0)) (+ x 1.0))))
                double code(double x, double y, double z) {
                	double tmp;
                	if (y <= -5e+41) {
                		tmp = x + 1.0;
                	} else if (y <= 4.7e+114) {
                		tmp = x - fma(y, z, -1.0);
                	} else {
                		tmp = x + 1.0;
                	}
                	return tmp;
                }
                
                function code(x, y, z)
                	tmp = 0.0
                	if (y <= -5e+41)
                		tmp = Float64(x + 1.0);
                	elseif (y <= 4.7e+114)
                		tmp = Float64(x - fma(y, z, -1.0));
                	else
                		tmp = Float64(x + 1.0);
                	end
                	return tmp
                end
                
                code[x_, y_, z_] := If[LessEqual[y, -5e+41], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 4.7e+114], N[(x - N[(y * z + -1.0), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                \mathbf{if}\;y \leq -5 \cdot 10^{+41}:\\
                \;\;\;\;x + 1\\
                
                \mathbf{elif}\;y \leq 4.7 \cdot 10^{+114}:\\
                \;\;\;\;x - \mathsf{fma}\left(y, z, -1\right)\\
                
                \mathbf{else}:\\
                \;\;\;\;x + 1\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if y < -5.00000000000000022e41 or 4.7000000000000001e114 < y

                  1. Initial program 99.8%

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

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

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

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

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

                  if -5.00000000000000022e41 < y < 4.7000000000000001e114

                  1. Initial program 100.0%

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

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

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

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

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

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

                      \[\leadsto \color{blue}{x - \left(y \cdot z - 1\right)} \]
                    6. sub-negN/A

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

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

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

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

                Alternative 10: 61.3% accurate, 15.1× speedup?

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

                  1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto -1 \cdot \color{blue}{\left(y \cdot \left(z \cdot \left(1 + \frac{-1}{6} \cdot {y}^{2}\right)\right)\right)} \]
                  7. Step-by-step derivation
                    1. Applied rewrites49.8%

                      \[\leadsto -y \cdot \mathsf{fma}\left(y, z \cdot \left(y \cdot -0.16666666666666666\right), z\right) \]
                    2. Taylor expanded in y around 0

                      \[\leadsto \mathsf{neg}\left(y \cdot z\right) \]
                    3. Step-by-step derivation
                      1. Applied rewrites50.7%

                        \[\leadsto -y \cdot z \]

                      if -5.39999999999999981e169 < z

                      1. Initial program 99.9%

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

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

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

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

                        \[\leadsto \color{blue}{x + 1} \]
                    4. Recombined 2 regimes into one program.
                    5. Add Preprocessing

                    Alternative 11: 61.2% accurate, 53.0× speedup?

                    \[\begin{array}{l} \\ x + 1 \end{array} \]
                    (FPCore (x y z) :precision binary64 (+ x 1.0))
                    double code(double x, double y, double z) {
                    	return x + 1.0;
                    }
                    
                    real(8) function code(x, y, z)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        real(8), intent (in) :: z
                        code = x + 1.0d0
                    end function
                    
                    public static double code(double x, double y, double z) {
                    	return x + 1.0;
                    }
                    
                    def code(x, y, z):
                    	return x + 1.0
                    
                    function code(x, y, z)
                    	return Float64(x + 1.0)
                    end
                    
                    function tmp = code(x, y, z)
                    	tmp = x + 1.0;
                    end
                    
                    code[x_, y_, z_] := N[(x + 1.0), $MachinePrecision]
                    
                    \begin{array}{l}
                    
                    \\
                    x + 1
                    \end{array}
                    
                    Derivation
                    1. Initial program 99.9%

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

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

                        \[\leadsto \color{blue}{x + 1} \]
                      2. lower-+.f6461.8

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

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

                    Alternative 12: 21.1% accurate, 212.0× speedup?

                    \[\begin{array}{l} \\ 1 \end{array} \]
                    (FPCore (x y z) :precision binary64 1.0)
                    double code(double x, double y, double z) {
                    	return 1.0;
                    }
                    
                    real(8) function code(x, y, z)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        real(8), intent (in) :: z
                        code = 1.0d0
                    end function
                    
                    public static double code(double x, double y, double z) {
                    	return 1.0;
                    }
                    
                    def code(x, y, z):
                    	return 1.0
                    
                    function code(x, y, z)
                    	return 1.0
                    end
                    
                    function tmp = code(x, y, z)
                    	tmp = 1.0;
                    end
                    
                    code[x_, y_, z_] := 1.0
                    
                    \begin{array}{l}
                    
                    \\
                    1
                    \end{array}
                    
                    Derivation
                    1. Initial program 99.9%

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

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

                        \[\leadsto \color{blue}{x + 1} \]
                      2. lower-+.f6461.8

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

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

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

                        \[\leadsto 1 \]
                      2. Add Preprocessing

                      Reproduce

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