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

Percentage Accurate: 99.9% → 99.9%
Time: 11.0s
Alternatives: 14
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 14 alternatives:

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

Initial Program: 99.9% accurate, 1.0× speedup?

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

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

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

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

      \[\leadsto \left(x + \cos y\right) - \color{blue}{z \cdot \sin y} \]
    3. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

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

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

Alternative 2: 99.1% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_0 := z \cdot \sin y\\
\mathbf{if}\;x \leq -1.6 \cdot 10^{-8}:\\
\;\;\;\;\mathsf{fma}\left(\sin y, -z, 1 + x\right)\\

\mathbf{elif}\;x \leq 6.6 \cdot 10^{-6}:\\
\;\;\;\;\cos y - t\_0\\

\mathbf{else}:\\
\;\;\;\;\left(x + 1\right) - t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.6000000000000001e-8

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

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

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

          \[\leadsto \left(x + 1\right) - \color{blue}{z \cdot \sin y} \]
        3. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

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

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

      if -1.6000000000000001e-8 < x < 6.60000000000000034e-6

      1. Initial program 99.9%

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

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

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

      if 6.60000000000000034e-6 < 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 rewrites100.0%

          \[\leadsto \left(x + \color{blue}{1}\right) - z \cdot \sin y \]
      5. Recombined 3 regimes into one program.
      6. Add Preprocessing

      Alternative 3: 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 4: 92.4% accurate, 1.7× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -7.5 \cdot 10^{-106} \lor \neg \left(z \leq 6 \cdot 10^{-123}\right):\\ \;\;\;\;\left(x + 1\right) - z \cdot \sin y\\ \mathbf{else}:\\ \;\;\;\;\left(x + \cos y\right) - z \cdot y\\ \end{array} \end{array} \]
      (FPCore (x y z)
       :precision binary64
       (if (or (<= z -7.5e-106) (not (<= z 6e-123)))
         (- (+ x 1.0) (* z (sin y)))
         (- (+ x (cos y)) (* z y))))
      double code(double x, double y, double z) {
      	double tmp;
      	if ((z <= -7.5e-106) || !(z <= 6e-123)) {
      		tmp = (x + 1.0) - (z * sin(y));
      	} else {
      		tmp = (x + cos(y)) - (z * y);
      	}
      	return tmp;
      }
      
      real(8) function code(x, y, z)
          real(8), intent (in) :: x
          real(8), intent (in) :: y
          real(8), intent (in) :: z
          real(8) :: tmp
          if ((z <= (-7.5d-106)) .or. (.not. (z <= 6d-123))) then
              tmp = (x + 1.0d0) - (z * sin(y))
          else
              tmp = (x + cos(y)) - (z * y)
          end if
          code = tmp
      end function
      
      public static double code(double x, double y, double z) {
      	double tmp;
      	if ((z <= -7.5e-106) || !(z <= 6e-123)) {
      		tmp = (x + 1.0) - (z * Math.sin(y));
      	} else {
      		tmp = (x + Math.cos(y)) - (z * y);
      	}
      	return tmp;
      }
      
      def code(x, y, z):
      	tmp = 0
      	if (z <= -7.5e-106) or not (z <= 6e-123):
      		tmp = (x + 1.0) - (z * math.sin(y))
      	else:
      		tmp = (x + math.cos(y)) - (z * y)
      	return tmp
      
      function code(x, y, z)
      	tmp = 0.0
      	if ((z <= -7.5e-106) || !(z <= 6e-123))
      		tmp = Float64(Float64(x + 1.0) - Float64(z * sin(y)));
      	else
      		tmp = Float64(Float64(x + cos(y)) - Float64(z * y));
      	end
      	return tmp
      end
      
      function tmp_2 = code(x, y, z)
      	tmp = 0.0;
      	if ((z <= -7.5e-106) || ~((z <= 6e-123)))
      		tmp = (x + 1.0) - (z * sin(y));
      	else
      		tmp = (x + cos(y)) - (z * y);
      	end
      	tmp_2 = tmp;
      end
      
      code[x_, y_, z_] := If[Or[LessEqual[z, -7.5e-106], N[Not[LessEqual[z, 6e-123]], $MachinePrecision]], N[(N[(x + 1.0), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;z \leq -7.5 \cdot 10^{-106} \lor \neg \left(z \leq 6 \cdot 10^{-123}\right):\\
      \;\;\;\;\left(x + 1\right) - z \cdot \sin y\\
      
      \mathbf{else}:\\
      \;\;\;\;\left(x + \cos y\right) - z \cdot y\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if z < -7.5000000000000002e-106 or 5.99999999999999968e-123 < 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 \left(x + \color{blue}{1}\right) - z \cdot \sin y \]
        4. Step-by-step derivation
          1. Applied rewrites95.7%

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

          if -7.5000000000000002e-106 < z < 5.99999999999999968e-123

          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 + \cos y\right) - \color{blue}{y \cdot z} \]
          4. Step-by-step derivation
            1. *-commutativeN/A

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

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

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -7.5 \cdot 10^{-106} \lor \neg \left(z \leq 6 \cdot 10^{-123}\right):\\ \;\;\;\;\left(x + 1\right) - z \cdot \sin y\\ \mathbf{else}:\\ \;\;\;\;\left(x + \cos y\right) - z \cdot y\\ \end{array} \]
        7. Add Preprocessing

        Alternative 5: 92.5% accurate, 1.7× speedup?

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

          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 rewrites96.9%

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

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

                \[\leadsto \left(x + 1\right) - \color{blue}{z \cdot \sin y} \]
              3. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

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

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

            if -7.5000000000000002e-106 < z < 5.99999999999999968e-123

            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 + \cos y\right) - \color{blue}{y \cdot z} \]
            4. Step-by-step derivation
              1. *-commutativeN/A

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

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

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

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

                \[\leadsto \left(x + \color{blue}{1}\right) - z \cdot \sin y \]
            5. Recombined 3 regimes into one program.
            6. Add Preprocessing

            Alternative 6: 69.7% accurate, 1.8× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -3.7 \cdot 10^{+34} \lor \neg \left(y \leq 5.5 \cdot 10^{+23}\right):\\ \;\;\;\;\left(-z\right) \cdot \sin y\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-z, y, 1 + x\right)\\ \end{array} \end{array} \]
            (FPCore (x y z)
             :precision binary64
             (if (or (<= y -3.7e+34) (not (<= y 5.5e+23)))
               (* (- z) (sin y))
               (fma (- z) y (+ 1.0 x))))
            double code(double x, double y, double z) {
            	double tmp;
            	if ((y <= -3.7e+34) || !(y <= 5.5e+23)) {
            		tmp = -z * sin(y);
            	} else {
            		tmp = fma(-z, y, (1.0 + x));
            	}
            	return tmp;
            }
            
            function code(x, y, z)
            	tmp = 0.0
            	if ((y <= -3.7e+34) || !(y <= 5.5e+23))
            		tmp = Float64(Float64(-z) * sin(y));
            	else
            		tmp = fma(Float64(-z), y, Float64(1.0 + x));
            	end
            	return tmp
            end
            
            code[x_, y_, z_] := If[Or[LessEqual[y, -3.7e+34], N[Not[LessEqual[y, 5.5e+23]], $MachinePrecision]], N[((-z) * N[Sin[y], $MachinePrecision]), $MachinePrecision], N[((-z) * y + N[(1.0 + x), $MachinePrecision]), $MachinePrecision]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;y \leq -3.7 \cdot 10^{+34} \lor \neg \left(y \leq 5.5 \cdot 10^{+23}\right):\\
            \;\;\;\;\left(-z\right) \cdot \sin y\\
            
            \mathbf{else}:\\
            \;\;\;\;\mathsf{fma}\left(-z, y, 1 + x\right)\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if y < -3.70000000000000009e34 or 5.50000000000000004e23 < y

              1. Initial program 99.9%

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

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

                  \[\leadsto \color{blue}{\mathsf{neg}\left(z \cdot \sin y\right)} \]
                2. distribute-lft-neg-inN/A

                  \[\leadsto \color{blue}{\left(\mathsf{neg}\left(z\right)\right) \cdot \sin y} \]
                3. lower-*.f64N/A

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

                  \[\leadsto \color{blue}{\left(-z\right)} \cdot \sin y \]
                5. lower-sin.f6446.7

                  \[\leadsto \left(-z\right) \cdot \color{blue}{\sin y} \]
              5. Applied rewrites46.7%

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

              if -3.70000000000000009e34 < y < 5.50000000000000004e23

              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. associate-+r+N/A

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

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

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

                  \[\leadsto \left(\mathsf{neg}\left(\color{blue}{z \cdot y}\right)\right) + \left(1 + x\right) \]
                5. distribute-lft-neg-inN/A

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

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

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

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

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

              \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.7 \cdot 10^{+34} \lor \neg \left(y \leq 5.5 \cdot 10^{+23}\right):\\ \;\;\;\;\left(-z\right) \cdot \sin y\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-z, y, 1 + x\right)\\ \end{array} \]
            5. Add Preprocessing

            Alternative 7: 88.6% accurate, 1.9× speedup?

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

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

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

              Alternative 8: 70.9% accurate, 4.9× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -15000000000000 \lor \neg \left(y \leq 23.5\right):\\ \;\;\;\;1 + x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666 \cdot \left(z \cdot y\right) - 0.5, y, -z\right), y, x - -1\right)\\ \end{array} \end{array} \]
              (FPCore (x y z)
               :precision binary64
               (if (or (<= y -15000000000000.0) (not (<= y 23.5)))
                 (+ 1.0 x)
                 (fma (fma (- (* 0.16666666666666666 (* z y)) 0.5) y (- z)) y (- x -1.0))))
              double code(double x, double y, double z) {
              	double tmp;
              	if ((y <= -15000000000000.0) || !(y <= 23.5)) {
              		tmp = 1.0 + x;
              	} else {
              		tmp = fma(fma(((0.16666666666666666 * (z * y)) - 0.5), y, -z), y, (x - -1.0));
              	}
              	return tmp;
              }
              
              function code(x, y, z)
              	tmp = 0.0
              	if ((y <= -15000000000000.0) || !(y <= 23.5))
              		tmp = Float64(1.0 + x);
              	else
              		tmp = fma(fma(Float64(Float64(0.16666666666666666 * Float64(z * y)) - 0.5), y, Float64(-z)), y, Float64(x - -1.0));
              	end
              	return tmp
              end
              
              code[x_, y_, z_] := If[Or[LessEqual[y, -15000000000000.0], N[Not[LessEqual[y, 23.5]], $MachinePrecision]], N[(1.0 + x), $MachinePrecision], N[(N[(N[(N[(0.16666666666666666 * N[(z * y), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision] * y + (-z)), $MachinePrecision] * y + N[(x - -1.0), $MachinePrecision]), $MachinePrecision]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              \mathbf{if}\;y \leq -15000000000000 \lor \neg \left(y \leq 23.5\right):\\
              \;\;\;\;1 + x\\
              
              \mathbf{else}:\\
              \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666 \cdot \left(z \cdot y\right) - 0.5, y, -z\right), y, x - -1\right)\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if y < -1.5e13 or 23.5 < 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. lower-+.f6438.8

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

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

                if -1.5e13 < y < 23.5

                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 + x} \]
                4. Step-by-step derivation
                  1. lower-+.f6477.6

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\frac{1}{6} \cdot \left(z \cdot y\right) - \frac{1}{2}, y, -z\right), y, \color{blue}{x - \left(\mathsf{neg}\left(x\right)\right) \cdot \frac{1}{x}}\right) \]
                  19. distribute-lft-neg-outN/A

                    \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\frac{1}{6} \cdot \left(z \cdot y\right) - \frac{1}{2}, y, -z\right), y, x - \color{blue}{\left(\mathsf{neg}\left(x \cdot \frac{1}{x}\right)\right)}\right) \]
                  20. rgt-mult-inverseN/A

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

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

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

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

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

              Alternative 9: 70.9% accurate, 7.1× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -66 \lor \neg \left(y \leq 540\right):\\ \;\;\;\;1 + x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.5 \cdot y - z, y, 1 + x\right)\\ \end{array} \end{array} \]
              (FPCore (x y z)
               :precision binary64
               (if (or (<= y -66.0) (not (<= y 540.0)))
                 (+ 1.0 x)
                 (fma (- (* -0.5 y) z) y (+ 1.0 x))))
              double code(double x, double y, double z) {
              	double tmp;
              	if ((y <= -66.0) || !(y <= 540.0)) {
              		tmp = 1.0 + x;
              	} else {
              		tmp = fma(((-0.5 * y) - z), y, (1.0 + x));
              	}
              	return tmp;
              }
              
              function code(x, y, z)
              	tmp = 0.0
              	if ((y <= -66.0) || !(y <= 540.0))
              		tmp = Float64(1.0 + x);
              	else
              		tmp = fma(Float64(Float64(-0.5 * y) - z), y, Float64(1.0 + x));
              	end
              	return tmp
              end
              
              code[x_, y_, z_] := If[Or[LessEqual[y, -66.0], N[Not[LessEqual[y, 540.0]], $MachinePrecision]], N[(1.0 + x), $MachinePrecision], N[(N[(N[(-0.5 * y), $MachinePrecision] - z), $MachinePrecision] * y + N[(1.0 + x), $MachinePrecision]), $MachinePrecision]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              \mathbf{if}\;y \leq -66 \lor \neg \left(y \leq 540\right):\\
              \;\;\;\;1 + x\\
              
              \mathbf{else}:\\
              \;\;\;\;\mathsf{fma}\left(-0.5 \cdot y - z, y, 1 + x\right)\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if y < -66 or 540 < 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. lower-+.f6438.8

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

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

                if -66 < y < 540

                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(\frac{-1}{2} \cdot y - z\right)\right)} \]
                4. Step-by-step derivation
                  1. associate-+r+N/A

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

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

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

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

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

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

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

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

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

              Alternative 10: 70.7% accurate, 8.8× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -34 \lor \neg \left(y \leq 2.8 \cdot 10^{+80}\right):\\ \;\;\;\;1 + x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-z, y, 1 + x\right)\\ \end{array} \end{array} \]
              (FPCore (x y z)
               :precision binary64
               (if (or (<= y -34.0) (not (<= y 2.8e+80))) (+ 1.0 x) (fma (- z) y (+ 1.0 x))))
              double code(double x, double y, double z) {
              	double tmp;
              	if ((y <= -34.0) || !(y <= 2.8e+80)) {
              		tmp = 1.0 + x;
              	} else {
              		tmp = fma(-z, y, (1.0 + x));
              	}
              	return tmp;
              }
              
              function code(x, y, z)
              	tmp = 0.0
              	if ((y <= -34.0) || !(y <= 2.8e+80))
              		tmp = Float64(1.0 + x);
              	else
              		tmp = fma(Float64(-z), y, Float64(1.0 + x));
              	end
              	return tmp
              end
              
              code[x_, y_, z_] := If[Or[LessEqual[y, -34.0], N[Not[LessEqual[y, 2.8e+80]], $MachinePrecision]], N[(1.0 + x), $MachinePrecision], N[((-z) * y + N[(1.0 + x), $MachinePrecision]), $MachinePrecision]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              \mathbf{if}\;y \leq -34 \lor \neg \left(y \leq 2.8 \cdot 10^{+80}\right):\\
              \;\;\;\;1 + x\\
              
              \mathbf{else}:\\
              \;\;\;\;\mathsf{fma}\left(-z, y, 1 + x\right)\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if y < -34 or 2.79999999999999984e80 < 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. lower-+.f6439.0

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

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

                if -34 < y < 2.79999999999999984e80

                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. associate-+r+N/A

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

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

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

                    \[\leadsto \left(\mathsf{neg}\left(\color{blue}{z \cdot y}\right)\right) + \left(1 + x\right) \]
                  5. distribute-lft-neg-inN/A

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

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

                    \[\leadsto \mathsf{fma}\left(\color{blue}{-z}, y, 1 + x\right) \]
                  8. lower-+.f6490.0

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

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

                \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -34 \lor \neg \left(y \leq 2.8 \cdot 10^{+80}\right):\\ \;\;\;\;1 + x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-z, y, 1 + x\right)\\ \end{array} \]
              5. Add Preprocessing

              Alternative 11: 67.5% accurate, 10.1× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2.7 \cdot 10^{-11} \lor \neg \left(x \leq 2.1 \cdot 10^{+15}\right):\\ \;\;\;\;1 + x\\ \mathbf{else}:\\ \;\;\;\;1 - z \cdot y\\ \end{array} \end{array} \]
              (FPCore (x y z)
               :precision binary64
               (if (or (<= x -2.7e-11) (not (<= x 2.1e+15))) (+ 1.0 x) (- 1.0 (* z y))))
              double code(double x, double y, double z) {
              	double tmp;
              	if ((x <= -2.7e-11) || !(x <= 2.1e+15)) {
              		tmp = 1.0 + x;
              	} else {
              		tmp = 1.0 - (z * y);
              	}
              	return tmp;
              }
              
              real(8) function code(x, y, z)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  real(8), intent (in) :: z
                  real(8) :: tmp
                  if ((x <= (-2.7d-11)) .or. (.not. (x <= 2.1d+15))) then
                      tmp = 1.0d0 + x
                  else
                      tmp = 1.0d0 - (z * y)
                  end if
                  code = tmp
              end function
              
              public static double code(double x, double y, double z) {
              	double tmp;
              	if ((x <= -2.7e-11) || !(x <= 2.1e+15)) {
              		tmp = 1.0 + x;
              	} else {
              		tmp = 1.0 - (z * y);
              	}
              	return tmp;
              }
              
              def code(x, y, z):
              	tmp = 0
              	if (x <= -2.7e-11) or not (x <= 2.1e+15):
              		tmp = 1.0 + x
              	else:
              		tmp = 1.0 - (z * y)
              	return tmp
              
              function code(x, y, z)
              	tmp = 0.0
              	if ((x <= -2.7e-11) || !(x <= 2.1e+15))
              		tmp = Float64(1.0 + x);
              	else
              		tmp = Float64(1.0 - Float64(z * y));
              	end
              	return tmp
              end
              
              function tmp_2 = code(x, y, z)
              	tmp = 0.0;
              	if ((x <= -2.7e-11) || ~((x <= 2.1e+15)))
              		tmp = 1.0 + x;
              	else
              		tmp = 1.0 - (z * y);
              	end
              	tmp_2 = tmp;
              end
              
              code[x_, y_, z_] := If[Or[LessEqual[x, -2.7e-11], N[Not[LessEqual[x, 2.1e+15]], $MachinePrecision]], N[(1.0 + x), $MachinePrecision], N[(1.0 - N[(z * y), $MachinePrecision]), $MachinePrecision]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              \mathbf{if}\;x \leq -2.7 \cdot 10^{-11} \lor \neg \left(x \leq 2.1 \cdot 10^{+15}\right):\\
              \;\;\;\;1 + x\\
              
              \mathbf{else}:\\
              \;\;\;\;1 - z \cdot y\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if x < -2.70000000000000005e-11 or 2.1e15 < 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 \color{blue}{1 + x} \]
                4. Step-by-step derivation
                  1. lower-+.f6478.8

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

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

                if -2.70000000000000005e-11 < x < 2.1e15

                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 + \left(x + -1 \cdot \left(y \cdot z\right)\right)} \]
                4. Step-by-step derivation
                  1. associate-+r+N/A

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

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

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

                    \[\leadsto \left(\mathsf{neg}\left(\color{blue}{z \cdot y}\right)\right) + \left(1 + x\right) \]
                  5. distribute-lft-neg-inN/A

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

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

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

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

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

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

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

                  \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.7 \cdot 10^{-11} \lor \neg \left(x \leq 2.1 \cdot 10^{+15}\right):\\ \;\;\;\;1 + x\\ \mathbf{else}:\\ \;\;\;\;1 - z \cdot y\\ \end{array} \]
                10. Add Preprocessing

                Alternative 12: 63.3% accurate, 15.1× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -4.8 \cdot 10^{+214}:\\ \;\;\;\;\left(-y\right) \cdot z\\ \mathbf{else}:\\ \;\;\;\;1 + x\\ \end{array} \end{array} \]
                (FPCore (x y z)
                 :precision binary64
                 (if (<= z -4.8e+214) (* (- y) z) (+ 1.0 x)))
                double code(double x, double y, double z) {
                	double tmp;
                	if (z <= -4.8e+214) {
                		tmp = -y * z;
                	} else {
                		tmp = 1.0 + x;
                	}
                	return tmp;
                }
                
                real(8) function code(x, y, z)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    real(8), intent (in) :: z
                    real(8) :: tmp
                    if (z <= (-4.8d+214)) then
                        tmp = -y * z
                    else
                        tmp = 1.0d0 + x
                    end if
                    code = tmp
                end function
                
                public static double code(double x, double y, double z) {
                	double tmp;
                	if (z <= -4.8e+214) {
                		tmp = -y * z;
                	} else {
                		tmp = 1.0 + x;
                	}
                	return tmp;
                }
                
                def code(x, y, z):
                	tmp = 0
                	if z <= -4.8e+214:
                		tmp = -y * z
                	else:
                		tmp = 1.0 + x
                	return tmp
                
                function code(x, y, z)
                	tmp = 0.0
                	if (z <= -4.8e+214)
                		tmp = Float64(Float64(-y) * z);
                	else
                		tmp = Float64(1.0 + x);
                	end
                	return tmp
                end
                
                function tmp_2 = code(x, y, z)
                	tmp = 0.0;
                	if (z <= -4.8e+214)
                		tmp = -y * z;
                	else
                		tmp = 1.0 + x;
                	end
                	tmp_2 = tmp;
                end
                
                code[x_, y_, z_] := If[LessEqual[z, -4.8e+214], N[((-y) * z), $MachinePrecision], N[(1.0 + x), $MachinePrecision]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                \mathbf{if}\;z \leq -4.8 \cdot 10^{+214}:\\
                \;\;\;\;\left(-y\right) \cdot z\\
                
                \mathbf{else}:\\
                \;\;\;\;1 + x\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if z < -4.8000000000000002e214

                  1. Initial program 99.9%

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

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

                      \[\leadsto \color{blue}{\mathsf{neg}\left(z \cdot \sin y\right)} \]
                    2. distribute-lft-neg-inN/A

                      \[\leadsto \color{blue}{\left(\mathsf{neg}\left(z\right)\right) \cdot \sin y} \]
                    3. lower-*.f64N/A

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

                      \[\leadsto \color{blue}{\left(-z\right)} \cdot \sin y \]
                    5. lower-sin.f6486.2

                      \[\leadsto \left(-z\right) \cdot \color{blue}{\sin y} \]
                  5. Applied rewrites86.2%

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

                    \[\leadsto -1 \cdot \color{blue}{\left(y \cdot z\right)} \]
                  7. Step-by-step derivation
                    1. Applied rewrites43.5%

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

                    if -4.8000000000000002e214 < 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. lower-+.f6465.8

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

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

                  Alternative 13: 62.8% accurate, 53.0× speedup?

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

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

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

                  Alternative 14: 22.0% 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. lower-+.f6460.0

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

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

                    \[\leadsto 1 \]
                  7. Step-by-step derivation
                    1. Applied rewrites22.0%

                      \[\leadsto 1 \]
                    2. Add Preprocessing

                    Reproduce

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