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

Percentage Accurate: 99.9% → 99.9%
Time: 11.3s
Alternatives: 11
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 11 alternatives:

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

Initial Program: 99.9% accurate, 1.0× speedup?

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

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

Alternative 1: 99.9% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 80.2% accurate, 0.2× speedup?

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

\\
\begin{array}{l}
t_0 := \left(x + \sin y\right) + \cos y \cdot z\\
\mathbf{if}\;t\_0 \leq -400000:\\
\;\;\;\;z + x\\

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

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

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

\mathbf{else}:\\
\;\;\;\;z + x\\


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

    1. Initial program 99.9%

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

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

        \[\leadsto \color{blue}{z + x} \]
      2. lower-+.f6472.3

        \[\leadsto \color{blue}{z + x} \]
    5. Simplified72.3%

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

    if -4e5 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < -0.0050000000000000001 or 1e-27 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 1

    1. Initial program 99.9%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sin y} \]
    7. Step-by-step derivation
      1. lower-sin.f6489.8

        \[\leadsto \color{blue}{\sin y} \]
    8. Simplified89.8%

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

    if -0.0050000000000000001 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 1e-27

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

Alternative 3: 64.6% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left(x + \sin y\right) + \cos y \cdot z \leq -4 \cdot 10^{+40}:\\ \;\;\;\;z + x\\ \mathbf{else}:\\ \;\;\;\;y + \left(z + x\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= (+ (+ x (sin y)) (* (cos y) z)) -4e+40) (+ z x) (+ y (+ z x))))
double code(double x, double y, double z) {
	double tmp;
	if (((x + sin(y)) + (cos(y) * z)) <= -4e+40) {
		tmp = z + x;
	} else {
		tmp = y + (z + 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 (((x + sin(y)) + (cos(y) * z)) <= (-4d+40)) then
        tmp = z + x
    else
        tmp = y + (z + x)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (((x + Math.sin(y)) + (Math.cos(y) * z)) <= -4e+40) {
		tmp = z + x;
	} else {
		tmp = y + (z + x);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if ((x + math.sin(y)) + (math.cos(y) * z)) <= -4e+40:
		tmp = z + x
	else:
		tmp = y + (z + x)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (Float64(Float64(x + sin(y)) + Float64(cos(y) * z)) <= -4e+40)
		tmp = Float64(z + x);
	else
		tmp = Float64(y + Float64(z + x));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (((x + sin(y)) + (cos(y) * z)) <= -4e+40)
		tmp = z + x;
	else
		tmp = y + (z + x);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(N[Cos[y], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], -4e+40], N[(z + x), $MachinePrecision], N[(y + N[(z + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\left(x + \sin y\right) + \cos y \cdot z \leq -4 \cdot 10^{+40}:\\
\;\;\;\;z + x\\

\mathbf{else}:\\
\;\;\;\;y + \left(z + x\right)\\


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

    1. Initial program 99.9%

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

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

        \[\leadsto \color{blue}{z + x} \]
      2. lower-+.f6474.8

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

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

    if -4.00000000000000012e40 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y)))

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

Alternative 4: 99.1% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \left(\cos y + \frac{x}{z}\right)\\ \mathbf{if}\;z \leq -6.1 \cdot 10^{+26}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 0.0085:\\ \;\;\;\;z + \left(x + \sin y\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* z (+ (cos y) (/ x z)))))
   (if (<= z -6.1e+26) t_0 (if (<= z 0.0085) (+ z (+ x (sin y))) t_0))))
double code(double x, double y, double z) {
	double t_0 = z * (cos(y) + (x / z));
	double tmp;
	if (z <= -6.1e+26) {
		tmp = t_0;
	} else if (z <= 0.0085) {
		tmp = z + (x + sin(y));
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = z * (cos(y) + (x / z))
    if (z <= (-6.1d+26)) then
        tmp = t_0
    else if (z <= 0.0085d0) then
        tmp = z + (x + sin(y))
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = z * (Math.cos(y) + (x / z));
	double tmp;
	if (z <= -6.1e+26) {
		tmp = t_0;
	} else if (z <= 0.0085) {
		tmp = z + (x + Math.sin(y));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = z * (math.cos(y) + (x / z))
	tmp = 0
	if z <= -6.1e+26:
		tmp = t_0
	elif z <= 0.0085:
		tmp = z + (x + math.sin(y))
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(z * Float64(cos(y) + Float64(x / z)))
	tmp = 0.0
	if (z <= -6.1e+26)
		tmp = t_0;
	elseif (z <= 0.0085)
		tmp = Float64(z + Float64(x + sin(y)));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = z * (cos(y) + (x / z));
	tmp = 0.0;
	if (z <= -6.1e+26)
		tmp = t_0;
	elseif (z <= 0.0085)
		tmp = z + (x + sin(y));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(N[Cos[y], $MachinePrecision] + N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -6.1e+26], t$95$0, If[LessEqual[z, 0.0085], N[(z + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := z \cdot \left(\cos y + \frac{x}{z}\right)\\
\mathbf{if}\;z \leq -6.1 \cdot 10^{+26}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq 0.0085:\\
\;\;\;\;z + \left(x + \sin y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -6.1000000000000003e26 or 0.0085000000000000006 < z

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto z \cdot \left(\cos y + \frac{x + \color{blue}{\sin y}}{z}\right) \]
    7. Simplified99.8%

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

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

        \[\leadsto z \cdot \left(\cos y + \color{blue}{\frac{x}{z}}\right) \]
    10. Simplified99.7%

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

    if -6.1000000000000003e26 < z < 0.0085000000000000006

    1. Initial program 100.0%

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -6.1 \cdot 10^{+26}:\\ \;\;\;\;z \cdot \left(\cos y + \frac{x}{z}\right)\\ \mathbf{elif}\;z \leq 0.0085:\\ \;\;\;\;z + \left(x + \sin y\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(\cos y + \frac{x}{z}\right)\\ \end{array} \]
    7. Add Preprocessing

    Alternative 5: 88.2% accurate, 1.7× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos y \cdot z\\ \mathbf{if}\;z \leq -6.8 \cdot 10^{+178}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 31000000000000:\\ \;\;\;\;z + \left(x + \sin y\right)\\ \mathbf{elif}\;z \leq 2 \cdot 10^{+99}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\cos y, z, y + x\right)\\ \end{array} \end{array} \]
    (FPCore (x y z)
     :precision binary64
     (let* ((t_0 (* (cos y) z)))
       (if (<= z -6.8e+178)
         t_0
         (if (<= z 31000000000000.0)
           (+ z (+ x (sin y)))
           (if (<= z 2e+99) t_0 (fma (cos y) z (+ y x)))))))
    double code(double x, double y, double z) {
    	double t_0 = cos(y) * z;
    	double tmp;
    	if (z <= -6.8e+178) {
    		tmp = t_0;
    	} else if (z <= 31000000000000.0) {
    		tmp = z + (x + sin(y));
    	} else if (z <= 2e+99) {
    		tmp = t_0;
    	} else {
    		tmp = fma(cos(y), z, (y + x));
    	}
    	return tmp;
    }
    
    function code(x, y, z)
    	t_0 = Float64(cos(y) * z)
    	tmp = 0.0
    	if (z <= -6.8e+178)
    		tmp = t_0;
    	elseif (z <= 31000000000000.0)
    		tmp = Float64(z + Float64(x + sin(y)));
    	elseif (z <= 2e+99)
    		tmp = t_0;
    	else
    		tmp = fma(cos(y), z, Float64(y + x));
    	end
    	return tmp
    end
    
    code[x_, y_, z_] := Block[{t$95$0 = N[(N[Cos[y], $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -6.8e+178], t$95$0, If[LessEqual[z, 31000000000000.0], N[(z + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2e+99], t$95$0, N[(N[Cos[y], $MachinePrecision] * z + N[(y + x), $MachinePrecision]), $MachinePrecision]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \cos y \cdot z\\
    \mathbf{if}\;z \leq -6.8 \cdot 10^{+178}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;z \leq 31000000000000:\\
    \;\;\;\;z + \left(x + \sin y\right)\\
    
    \mathbf{elif}\;z \leq 2 \cdot 10^{+99}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{else}:\\
    \;\;\;\;\mathsf{fma}\left(\cos y, z, y + x\right)\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if z < -6.8000000000000005e178 or 3.1e13 < z < 1.9999999999999999e99

      1. Initial program 99.7%

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

        \[\leadsto \color{blue}{z \cdot \cos y} \]
      4. Step-by-step derivation
        1. lower-*.f64N/A

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

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

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

      if -6.8000000000000005e178 < z < 3.1e13

      1. Initial program 99.9%

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

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

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

        if 1.9999999999999999e99 < z

        1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{x + y}\right) \]
        6. Step-by-step derivation
          1. lower-+.f6488.7

            \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{x + y}\right) \]
        7. Simplified88.7%

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

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

      Alternative 6: 83.5% accurate, 1.7× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos y \cdot z\\ \mathbf{if}\;z \leq -6.8 \cdot 10^{+178}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -1.14 \cdot 10^{-48}:\\ \;\;\;\;z + x\\ \mathbf{elif}\;z \leq 0.36:\\ \;\;\;\;x + \sin y\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
      (FPCore (x y z)
       :precision binary64
       (let* ((t_0 (* (cos y) z)))
         (if (<= z -6.8e+178)
           t_0
           (if (<= z -1.14e-48) (+ z x) (if (<= z 0.36) (+ x (sin y)) t_0)))))
      double code(double x, double y, double z) {
      	double t_0 = cos(y) * z;
      	double tmp;
      	if (z <= -6.8e+178) {
      		tmp = t_0;
      	} else if (z <= -1.14e-48) {
      		tmp = z + x;
      	} else if (z <= 0.36) {
      		tmp = x + sin(y);
      	} else {
      		tmp = t_0;
      	}
      	return tmp;
      }
      
      real(8) function code(x, y, z)
          real(8), intent (in) :: x
          real(8), intent (in) :: y
          real(8), intent (in) :: z
          real(8) :: t_0
          real(8) :: tmp
          t_0 = cos(y) * z
          if (z <= (-6.8d+178)) then
              tmp = t_0
          else if (z <= (-1.14d-48)) then
              tmp = z + x
          else if (z <= 0.36d0) then
              tmp = x + sin(y)
          else
              tmp = t_0
          end if
          code = tmp
      end function
      
      public static double code(double x, double y, double z) {
      	double t_0 = Math.cos(y) * z;
      	double tmp;
      	if (z <= -6.8e+178) {
      		tmp = t_0;
      	} else if (z <= -1.14e-48) {
      		tmp = z + x;
      	} else if (z <= 0.36) {
      		tmp = x + Math.sin(y);
      	} else {
      		tmp = t_0;
      	}
      	return tmp;
      }
      
      def code(x, y, z):
      	t_0 = math.cos(y) * z
      	tmp = 0
      	if z <= -6.8e+178:
      		tmp = t_0
      	elif z <= -1.14e-48:
      		tmp = z + x
      	elif z <= 0.36:
      		tmp = x + math.sin(y)
      	else:
      		tmp = t_0
      	return tmp
      
      function code(x, y, z)
      	t_0 = Float64(cos(y) * z)
      	tmp = 0.0
      	if (z <= -6.8e+178)
      		tmp = t_0;
      	elseif (z <= -1.14e-48)
      		tmp = Float64(z + x);
      	elseif (z <= 0.36)
      		tmp = Float64(x + sin(y));
      	else
      		tmp = t_0;
      	end
      	return tmp
      end
      
      function tmp_2 = code(x, y, z)
      	t_0 = cos(y) * z;
      	tmp = 0.0;
      	if (z <= -6.8e+178)
      		tmp = t_0;
      	elseif (z <= -1.14e-48)
      		tmp = z + x;
      	elseif (z <= 0.36)
      		tmp = x + sin(y);
      	else
      		tmp = t_0;
      	end
      	tmp_2 = tmp;
      end
      
      code[x_, y_, z_] := Block[{t$95$0 = N[(N[Cos[y], $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -6.8e+178], t$95$0, If[LessEqual[z, -1.14e-48], N[(z + x), $MachinePrecision], If[LessEqual[z, 0.36], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], t$95$0]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := \cos y \cdot z\\
      \mathbf{if}\;z \leq -6.8 \cdot 10^{+178}:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;z \leq -1.14 \cdot 10^{-48}:\\
      \;\;\;\;z + x\\
      
      \mathbf{elif}\;z \leq 0.36:\\
      \;\;\;\;x + \sin y\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_0\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if z < -6.8000000000000005e178 or 0.35999999999999999 < z

        1. Initial program 99.8%

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

          \[\leadsto \color{blue}{z \cdot \cos y} \]
        4. Step-by-step derivation
          1. lower-*.f64N/A

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

            \[\leadsto z \cdot \color{blue}{\cos y} \]
        5. Simplified82.3%

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

        if -6.8000000000000005e178 < z < -1.1400000000000001e-48

        1. Initial program 99.9%

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

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

            \[\leadsto \color{blue}{z + x} \]
          2. lower-+.f6476.7

            \[\leadsto \color{blue}{z + x} \]
        5. Simplified76.7%

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

        if -1.1400000000000001e-48 < z < 0.35999999999999999

        1. Initial program 100.0%

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

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

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

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

            \[\leadsto \color{blue}{\sin y} + x \]
        5. Simplified94.0%

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -6.8 \cdot 10^{+178}:\\ \;\;\;\;\cos y \cdot z\\ \mathbf{elif}\;z \leq -1.14 \cdot 10^{-48}:\\ \;\;\;\;z + x\\ \mathbf{elif}\;z \leq 0.36:\\ \;\;\;\;x + \sin y\\ \mathbf{else}:\\ \;\;\;\;\cos y \cdot z\\ \end{array} \]
      5. Add Preprocessing

      Alternative 7: 83.7% accurate, 1.7× speedup?

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

        1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{x + y}\right) \]
        6. Step-by-step derivation
          1. lower-+.f6480.6

            \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{x + y}\right) \]
        7. Simplified80.6%

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

        if -1.04999999999999994e-48 < z < 4.1999999999999996e-6

        1. Initial program 100.0%

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

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

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

            \[\leadsto \color{blue}{\sin y + x} \]
          3. lower-sin.f6493.9

            \[\leadsto \color{blue}{\sin y} + x \]
        5. Simplified93.9%

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

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

      Alternative 8: 80.5% accurate, 1.8× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := x + \sin y\\ \mathbf{if}\;y \leq -0.054:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 1000000:\\ \;\;\;\;z + \mathsf{fma}\left(y, \mathsf{fma}\left(y, z \cdot -0.5, 1\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
      (FPCore (x y z)
       :precision binary64
       (let* ((t_0 (+ x (sin y))))
         (if (<= y -0.054)
           t_0
           (if (<= y 1000000.0) (+ z (fma y (fma y (* z -0.5) 1.0) x)) t_0))))
      double code(double x, double y, double z) {
      	double t_0 = x + sin(y);
      	double tmp;
      	if (y <= -0.054) {
      		tmp = t_0;
      	} else if (y <= 1000000.0) {
      		tmp = z + fma(y, fma(y, (z * -0.5), 1.0), x);
      	} else {
      		tmp = t_0;
      	}
      	return tmp;
      }
      
      function code(x, y, z)
      	t_0 = Float64(x + sin(y))
      	tmp = 0.0
      	if (y <= -0.054)
      		tmp = t_0;
      	elseif (y <= 1000000.0)
      		tmp = Float64(z + fma(y, fma(y, Float64(z * -0.5), 1.0), x));
      	else
      		tmp = t_0;
      	end
      	return tmp
      end
      
      code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -0.054], t$95$0, If[LessEqual[y, 1000000.0], N[(z + N[(y * N[(y * N[(z * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], t$95$0]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := x + \sin y\\
      \mathbf{if}\;y \leq -0.054:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;y \leq 1000000:\\
      \;\;\;\;z + \mathsf{fma}\left(y, \mathsf{fma}\left(y, z \cdot -0.5, 1\right), x\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_0\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if y < -0.0539999999999999994 or 1e6 < y

        1. Initial program 99.8%

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

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

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

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

            \[\leadsto \color{blue}{\sin y} + x \]
        5. Simplified54.7%

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

        if -0.0539999999999999994 < y < 1e6

        1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 9: 70.1% accurate, 6.4× speedup?

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

        1. Initial program 99.7%

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

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

            \[\leadsto \color{blue}{z + x} \]
          2. lower-+.f6431.3

            \[\leadsto \color{blue}{z + x} \]
        5. Simplified31.3%

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

        if -5.8e22 < y < 1.76e31

        1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 10: 66.4% accurate, 53.0× speedup?

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

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

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

          \[\leadsto \color{blue}{z + x} \]
        2. lower-+.f6462.6

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

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

      Alternative 11: 37.9% accurate, 53.0× speedup?

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

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

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

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

          \[\leadsto \color{blue}{\sin y + x} \]
        3. lower-sin.f6454.9

          \[\leadsto \color{blue}{\sin y} + x \]
      5. Simplified54.9%

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

        \[\leadsto \color{blue}{x + y} \]
      7. Step-by-step derivation
        1. lower-+.f6437.6

          \[\leadsto \color{blue}{x + y} \]
      8. Simplified37.6%

        \[\leadsto \color{blue}{x + y} \]
      9. Final simplification37.6%

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

      Reproduce

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