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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 98.6% 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\\ \mathbf{if}\;t\_2 \leq -1 \cdot 10^{+17}:\\ \;\;\;\;\mathsf{fma}\left(\sin y, -z, 1 + x\right)\\ \mathbf{elif}\;t\_2 \leq 0.9999999999999775:\\ \;\;\;\;\frac{1}{\frac{1}{t\_0}}\\ \mathbf{else}:\\ \;\;\;\;\left(1 + x\right) - t\_1\\ \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)))
   (if (<= t_2 -1e+17)
     (fma (sin y) (- z) (+ 1.0 x))
     (if (<= t_2 0.9999999999999775) (/ 1.0 (/ 1.0 t_0)) (- (+ 1.0 x) t_1)))))
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 tmp;
	if (t_2 <= -1e+17) {
		tmp = fma(sin(y), -z, (1.0 + x));
	} else if (t_2 <= 0.9999999999999775) {
		tmp = 1.0 / (1.0 / t_0);
	} else {
		tmp = (1.0 + x) - t_1;
	}
	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)
	tmp = 0.0
	if (t_2 <= -1e+17)
		tmp = fma(sin(y), Float64(-z), Float64(1.0 + x));
	elseif (t_2 <= 0.9999999999999775)
		tmp = Float64(1.0 / Float64(1.0 / t_0));
	else
		tmp = Float64(Float64(1.0 + x) - t_1);
	end
	return 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]}, If[LessEqual[t$95$2, -1e+17], N[(N[Sin[y], $MachinePrecision] * (-z) + N[(1.0 + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.9999999999999775], N[(1.0 / N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + x), $MachinePrecision] - t$95$1), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x + \cos y\\
t_1 := z \cdot \sin y\\
t_2 := t\_0 - t\_1\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+17}:\\
\;\;\;\;\mathsf{fma}\left(\sin y, -z, 1 + x\right)\\

\mathbf{elif}\;t\_2 \leq 0.9999999999999775:\\
\;\;\;\;\frac{1}{\frac{1}{t\_0}}\\

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


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

    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.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. cancel-sub-sign-invN/A

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

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

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

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

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

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

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

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

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

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

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

      if -1e17 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < 0.999999999999977462

      1. Initial program 100.0%

        \[\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. flip--N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\color{blue}{\frac{1}{x + \cos y}}} \]
      6. Step-by-step derivation
        1. lower-/.f64N/A

          \[\leadsto \frac{1}{\color{blue}{\frac{1}{x + \cos y}}} \]
        2. +-commutativeN/A

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

          \[\leadsto \frac{1}{\frac{1}{\color{blue}{\cos y + x}}} \]
        4. lower-cos.f6499.0

          \[\leadsto \frac{1}{\frac{1}{\color{blue}{\cos y} + x}} \]
      7. Applied rewrites99.0%

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

      if 0.999999999999977462 < (-.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.9%

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;\left(x + \cos y\right) - z \cdot \sin y \leq -1 \cdot 10^{+17}:\\ \;\;\;\;\mathsf{fma}\left(\sin y, -z, 1 + x\right)\\ \mathbf{elif}\;\left(x + \cos y\right) - z \cdot \sin y \leq 0.9999999999999775:\\ \;\;\;\;\frac{1}{\frac{1}{x + \cos y}}\\ \mathbf{else}:\\ \;\;\;\;\left(1 + x\right) - z \cdot \sin y\\ \end{array} \]
      7. 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.0% accurate, 1.7× speedup?

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

        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 rewrites93.8%

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

          if -1.3e-151 < z < 2.6e-47

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

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

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

          if 2.6e-47 < 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 rewrites97.5%

              \[\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. cancel-sub-sign-invN/A

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.3 \cdot 10^{-151}:\\ \;\;\;\;\left(1 + x\right) - z \cdot \sin y\\ \mathbf{elif}\;z \leq 2.6 \cdot 10^{-47}:\\ \;\;\;\;\left(x + \cos y\right) - z \cdot y\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\sin y, -z, 1 + x\right)\\ \end{array} \]
          7. Add Preprocessing

          Alternative 5: 92.0% accurate, 1.7× speedup?

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

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

              if -1.3e-151 < z < 2.6e-47

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

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

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

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

            Alternative 6: 71.8% accurate, 1.8× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(-z\right) \cdot \sin y\\ \mathbf{if}\;z \leq -7.5 \cdot 10^{+148}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 4.8 \cdot 10^{+70}:\\ \;\;\;\;x - \mathsf{fma}\left(y, \frac{1}{\mathsf{fma}\left(\frac{\frac{y}{z} \cdot 0.25}{z \cdot z}, y, \frac{1}{z}\right)}, -1\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
            (FPCore (x y z)
             :precision binary64
             (let* ((t_0 (* (- z) (sin y))))
               (if (<= z -7.5e+148)
                 t_0
                 (if (<= z 4.8e+70)
                   (-
                    x
                    (fma y (/ 1.0 (fma (/ (* (/ y z) 0.25) (* z z)) y (/ 1.0 z))) -1.0))
                   t_0))))
            double code(double x, double y, double z) {
            	double t_0 = -z * sin(y);
            	double tmp;
            	if (z <= -7.5e+148) {
            		tmp = t_0;
            	} else if (z <= 4.8e+70) {
            		tmp = x - fma(y, (1.0 / fma((((y / z) * 0.25) / (z * z)), y, (1.0 / z))), -1.0);
            	} else {
            		tmp = t_0;
            	}
            	return tmp;
            }
            
            function code(x, y, z)
            	t_0 = Float64(Float64(-z) * sin(y))
            	tmp = 0.0
            	if (z <= -7.5e+148)
            		tmp = t_0;
            	elseif (z <= 4.8e+70)
            		tmp = Float64(x - fma(y, Float64(1.0 / fma(Float64(Float64(Float64(y / z) * 0.25) / Float64(z * z)), y, Float64(1.0 / z))), -1.0));
            	else
            		tmp = t_0;
            	end
            	return tmp
            end
            
            code[x_, y_, z_] := Block[{t$95$0 = N[((-z) * N[Sin[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7.5e+148], t$95$0, If[LessEqual[z, 4.8e+70], N[(x - N[(y * N[(1.0 / N[(N[(N[(N[(y / z), $MachinePrecision] * 0.25), $MachinePrecision] / N[(z * z), $MachinePrecision]), $MachinePrecision] * y + N[(1.0 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            t_0 := \left(-z\right) \cdot \sin y\\
            \mathbf{if}\;z \leq -7.5 \cdot 10^{+148}:\\
            \;\;\;\;t\_0\\
            
            \mathbf{elif}\;z \leq 4.8 \cdot 10^{+70}:\\
            \;\;\;\;x - \mathsf{fma}\left(y, \frac{1}{\mathsf{fma}\left(\frac{\frac{y}{z} \cdot 0.25}{z \cdot z}, y, \frac{1}{z}\right)}, -1\right)\\
            
            \mathbf{else}:\\
            \;\;\;\;t\_0\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if z < -7.50000000000000008e148 or 4.79999999999999974e70 < z

              1. Initial program 99.8%

                \[\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.f6468.5

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

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

              if -7.50000000000000008e148 < z < 4.79999999999999974e70

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

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

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

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

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

                  \[\leadsto x - \color{blue}{\left(\left(\mathsf{neg}\left(y\right)\right) \cdot \left(\frac{-1}{2} \cdot y - z\right) + \left(\mathsf{neg}\left(1\right)\right)\right)} \]
              5. Applied rewrites62.8%

                \[\leadsto \color{blue}{x - \mathsf{fma}\left(y, \mathsf{fma}\left(0.5, y, z\right), -1\right)} \]
              6. Step-by-step derivation
                1. Applied rewrites62.8%

                  \[\leadsto x - \mathsf{fma}\left(y, \frac{1}{\color{blue}{\frac{\mathsf{fma}\left(0.5, y, -z\right)}{\mathsf{fma}\left(0.25, y \cdot y, \left(-z\right) \cdot z\right)}}}, -1\right) \]
                2. Taylor expanded in y around 0

                  \[\leadsto x - \mathsf{fma}\left(y, \frac{1}{y \cdot \left(\frac{1}{4} \cdot \frac{y}{{z}^{3}} - \frac{1}{2} \cdot \frac{1}{{z}^{2}}\right) + \color{blue}{\frac{1}{z}}}, -1\right) \]
                3. Step-by-step derivation
                  1. Applied rewrites78.4%

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

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

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

                  Alternative 7: 88.1% accurate, 1.9× speedup?

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

                      \[\leadsto \left(x + \color{blue}{1}\right) - z \cdot \sin y \]
                    2. Final simplification86.9%

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

                    Alternative 8: 68.3% accurate, 3.0× speedup?

                    \[\begin{array}{l} \\ x - \mathsf{fma}\left(y, \frac{1}{\mathsf{fma}\left(\frac{\frac{y}{z} \cdot 0.25}{z \cdot z}, y, \frac{1}{z}\right)}, -1\right) \end{array} \]
                    (FPCore (x y z)
                     :precision binary64
                     (- x (fma y (/ 1.0 (fma (/ (* (/ y z) 0.25) (* z z)) y (/ 1.0 z))) -1.0)))
                    double code(double x, double y, double z) {
                    	return x - fma(y, (1.0 / fma((((y / z) * 0.25) / (z * z)), y, (1.0 / z))), -1.0);
                    }
                    
                    function code(x, y, z)
                    	return Float64(x - fma(y, Float64(1.0 / fma(Float64(Float64(Float64(y / z) * 0.25) / Float64(z * z)), y, Float64(1.0 / z))), -1.0))
                    end
                    
                    code[x_, y_, z_] := N[(x - N[(y * N[(1.0 / N[(N[(N[(N[(y / z), $MachinePrecision] * 0.25), $MachinePrecision] / N[(z * z), $MachinePrecision]), $MachinePrecision] * y + N[(1.0 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]
                    
                    \begin{array}{l}
                    
                    \\
                    x - \mathsf{fma}\left(y, \frac{1}{\mathsf{fma}\left(\frac{\frac{y}{z} \cdot 0.25}{z \cdot z}, y, \frac{1}{z}\right)}, -1\right)
                    \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 + \left(x + y \cdot \left(\frac{-1}{2} \cdot y - z\right)\right)} \]
                    4. Step-by-step derivation
                      1. +-commutativeN/A

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

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

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

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

                        \[\leadsto x - \color{blue}{\left(\left(\mathsf{neg}\left(y\right)\right) \cdot \left(\frac{-1}{2} \cdot y - z\right) + \left(\mathsf{neg}\left(1\right)\right)\right)} \]
                    5. Applied rewrites58.6%

                      \[\leadsto \color{blue}{x - \mathsf{fma}\left(y, \mathsf{fma}\left(0.5, y, z\right), -1\right)} \]
                    6. Step-by-step derivation
                      1. Applied rewrites48.2%

                        \[\leadsto x - \mathsf{fma}\left(y, \frac{1}{\color{blue}{\frac{\mathsf{fma}\left(0.5, y, -z\right)}{\mathsf{fma}\left(0.25, y \cdot y, \left(-z\right) \cdot z\right)}}}, -1\right) \]
                      2. Taylor expanded in y around 0

                        \[\leadsto x - \mathsf{fma}\left(y, \frac{1}{y \cdot \left(\frac{1}{4} \cdot \frac{y}{{z}^{3}} - \frac{1}{2} \cdot \frac{1}{{z}^{2}}\right) + \color{blue}{\frac{1}{z}}}, -1\right) \]
                      3. Step-by-step derivation
                        1. Applied rewrites69.9%

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

                          \[\leadsto x - \mathsf{fma}\left(y, \frac{1}{\mathsf{fma}\left(\frac{\frac{1}{4} \cdot \frac{y}{z}}{z \cdot z}, y, \frac{1}{z}\right)}, -1\right) \]
                        3. Step-by-step derivation
                          1. Applied rewrites69.9%

                            \[\leadsto x - \mathsf{fma}\left(y, \frac{1}{\mathsf{fma}\left(\frac{\frac{y}{z} \cdot 0.25}{z \cdot z}, y, \frac{1}{z}\right)}, -1\right) \]
                          2. Add Preprocessing

                          Alternative 9: 69.9% accurate, 7.6× speedup?

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

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

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

                            if -2.94999999999999994e23 < y < 1e18

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

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

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

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

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

                                \[\leadsto x - \color{blue}{\left(\left(\mathsf{neg}\left(y\right)\right) \cdot \left(\frac{-1}{2} \cdot y - z\right) + \left(\mathsf{neg}\left(1\right)\right)\right)} \]
                            5. Applied rewrites96.1%

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

                          Alternative 10: 69.8% accurate, 9.6× speedup?

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

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

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

                            if -2.14999999999999996e77 < y < 1.25e18

                            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. distribute-rgt-neg-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

                          Alternative 11: 63.9% accurate, 14.1× speedup?

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

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

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

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

                            if 1.00000000000000003e170 < 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 + \left(x + y \cdot \left(\frac{-1}{2} \cdot y - z\right)\right)} \]
                            4. Step-by-step derivation
                              1. +-commutativeN/A

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

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

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

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

                                \[\leadsto x - \color{blue}{\left(\left(\mathsf{neg}\left(y\right)\right) \cdot \left(\frac{-1}{2} \cdot y - z\right) + \left(\mathsf{neg}\left(1\right)\right)\right)} \]
                            5. Applied rewrites69.5%

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

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

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

                                \[\leadsto x - y \cdot \color{blue}{z} \]
                              3. Step-by-step derivation
                                1. Applied rewrites67.2%

                                  \[\leadsto x - y \cdot \color{blue}{z} \]
                              4. Recombined 2 regimes into one program.
                              5. Final simplification67.3%

                                \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 10^{+170}:\\ \;\;\;\;1 + x\\ \mathbf{else}:\\ \;\;\;\;x - z \cdot y\\ \end{array} \]
                              6. Add Preprocessing

                              Alternative 12: 62.6% accurate, 15.1× speedup?

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

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

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

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

                                if 1.04999999999999996e230 < z

                                1. Initial program 99.8%

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

                                    \[\leadsto \left(-z\right) \cdot \color{blue}{\sin y} \]
                                5. Applied rewrites83.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 rewrites46.2%

                                    \[\leadsto \left(-y\right) \cdot \color{blue}{z} \]
                                8. Recombined 2 regimes into one program.
                                9. Add Preprocessing

                                Alternative 13: 61.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-+.f6463.7

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

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

                                Alternative 14: 22.4% 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-+.f6463.7

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

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

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

                                    \[\leadsto 1 \]
                                  2. Add Preprocessing

                                  Reproduce

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