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

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

\\
z \cdot \cos y + \left(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. Final simplification99.9%

    \[\leadsto z \cdot \cos y + \left(x + \sin y\right) \]
  4. Add Preprocessing

Alternative 2: 71.8% accurate, 1.7× speedup?

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

\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -4 \cdot 10^{+169}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq -1.75 \cdot 10^{-134}:\\
\;\;\;\;x + z\\

\mathbf{elif}\;z \leq -4.2 \cdot 10^{-257}:\\
\;\;\;\;\sin y\\

\mathbf{elif}\;z \leq 1.12 \cdot 10^{+104}:\\
\;\;\;\;x + z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -3.99999999999999974e169 or 1.12000000000000003e104 < z

    1. Initial program 99.9%

      \[\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. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(z, \color{blue}{\cos y}\right) \]
      2. cos-lowering-cos.f6483.3%

        \[\leadsto \mathsf{*.f64}\left(z, \mathsf{cos.f64}\left(y\right)\right) \]
    5. Simplified83.3%

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

    if -3.99999999999999974e169 < z < -1.7499999999999999e-134 or -4.2000000000000002e-257 < z < 1.12000000000000003e104

    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 + z} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

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

        \[\leadsto \mathsf{+.f64}\left(z, \color{blue}{x}\right) \]
    5. Simplified74.8%

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

    if -1.7499999999999999e-134 < z < -4.2000000000000002e-257

    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 \sin y + \color{blue}{x} \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\sin y, \color{blue}{x}\right) \]
      3. sin-lowering-sin.f6496.4%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{sin.f64}\left(y\right), x\right) \]
    5. Simplified96.4%

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

      \[\leadsto \color{blue}{\sin y} \]
    7. Step-by-step derivation
      1. sin-lowering-sin.f6478.7%

        \[\leadsto \mathsf{sin.f64}\left(y\right) \]
    8. Simplified78.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4 \cdot 10^{+169}:\\ \;\;\;\;z \cdot \cos y\\ \mathbf{elif}\;z \leq -1.75 \cdot 10^{-134}:\\ \;\;\;\;x + z\\ \mathbf{elif}\;z \leq -4.2 \cdot 10^{-257}:\\ \;\;\;\;\sin y\\ \mathbf{elif}\;z \leq 1.12 \cdot 10^{+104}:\\ \;\;\;\;x + z\\ \mathbf{else}:\\ \;\;\;\;z \cdot \cos y\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 80.0% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
t_0 := x + \sin y\\
\mathbf{if}\;y \leq -6.2 \cdot 10^{+76}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y \leq -165:\\
\;\;\;\;z \cdot \cos y\\

\mathbf{elif}\;y \leq 1.05:\\
\;\;\;\;\left(x + y \cdot \left(1 + y \cdot \left(y \cdot -0.16666666666666666\right)\right)\right) + \left(z + \left(y \cdot \left(y \cdot z\right)\right) \cdot \left(-0.5 + y \cdot \left(y \cdot 0.041666666666666664\right)\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -6.20000000000000023e76 or 1.05000000000000004 < y

    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 \sin y + \color{blue}{x} \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\sin y, \color{blue}{x}\right) \]
      3. sin-lowering-sin.f6467.7%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{sin.f64}\left(y\right), x\right) \]
    5. Simplified67.7%

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

    if -6.20000000000000023e76 < y < -165

    1. Initial program 99.6%

      \[\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. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(z, \color{blue}{\cos y}\right) \]
      2. cos-lowering-cos.f6473.3%

        \[\leadsto \mathsf{*.f64}\left(z, \mathsf{cos.f64}\left(y\right)\right) \]
    5. Simplified73.3%

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

    if -165 < y < 1.05000000000000004

    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 \mathsf{+.f64}\left(\color{blue}{\left(x + y \cdot \left(1 + \frac{-1}{6} \cdot {y}^{2}\right)\right)}, \mathsf{*.f64}\left(z, \mathsf{cos.f64}\left(y\right)\right)\right) \]
    4. Step-by-step derivation
      1. +-lowering-+.f64N/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{+.f64}\left(x, \mathsf{*.f64}\left(y, \left(1 + \frac{-1}{6} \cdot {y}^{2}\right)\right)\right), \mathsf{*.f64}\left(z, \mathsf{cos.f64}\left(y\right)\right)\right) \]
      3. +-lowering-+.f64N/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{+.f64}\left(x, \mathsf{*.f64}\left(y, \mathsf{+.f64}\left(1, \left(\frac{-1}{6} \cdot \left(y \cdot y\right)\right)\right)\right)\right), \mathsf{*.f64}\left(z, \mathsf{cos.f64}\left(y\right)\right)\right) \]
      5. associate-*r*N/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{+.f64}\left(x, \mathsf{*.f64}\left(y, \mathsf{+.f64}\left(1, \left(y \cdot \left(\frac{-1}{6} \cdot y\right)\right)\right)\right)\right), \mathsf{*.f64}\left(z, \mathsf{cos.f64}\left(y\right)\right)\right) \]
      7. *-lowering-*.f64N/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{+.f64}\left(x, \mathsf{*.f64}\left(y, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(y, \left(y \cdot \frac{-1}{6}\right)\right)\right)\right)\right), \mathsf{*.f64}\left(z, \mathsf{cos.f64}\left(y\right)\right)\right) \]
      9. *-lowering-*.f64100.0%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{+.f64}\left(x, \mathsf{*.f64}\left(y, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(y, \mathsf{*.f64}\left(y, \frac{-1}{6}\right)\right)\right)\right)\right), \mathsf{*.f64}\left(z, \mathsf{cos.f64}\left(y\right)\right)\right) \]
    5. Simplified100.0%

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

      \[\leadsto \mathsf{+.f64}\left(\mathsf{+.f64}\left(x, \mathsf{*.f64}\left(y, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(y, \mathsf{*.f64}\left(y, \frac{-1}{6}\right)\right)\right)\right)\right), \color{blue}{\left(z + {y}^{2} \cdot \left(\frac{-1}{2} \cdot z + \frac{1}{24} \cdot \left({y}^{2} \cdot z\right)\right)\right)}\right) \]
    7. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{+.f64}\left(x, \mathsf{*.f64}\left(y, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(y, \mathsf{*.f64}\left(y, \frac{-1}{6}\right)\right)\right)\right)\right), \mathsf{+.f64}\left(z, \color{blue}{\left({y}^{2} \cdot \left(\frac{-1}{2} \cdot z + \frac{1}{24} \cdot \left({y}^{2} \cdot z\right)\right)\right)}\right)\right) \]
      2. distribute-lft-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{+.f64}\left(x, \mathsf{*.f64}\left(y, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(y, \mathsf{*.f64}\left(y, \frac{-1}{6}\right)\right)\right)\right)\right), \mathsf{+.f64}\left(z, \mathsf{*.f64}\left(\mathsf{*.f64}\left(y, \mathsf{*.f64}\left(y, z\right)\right), \mathsf{+.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(y, \left(y \cdot \color{blue}{\frac{1}{24}}\right)\right)\right)\right)\right)\right) \]
      22. *-lowering-*.f64100.0%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{+.f64}\left(x, \mathsf{*.f64}\left(y, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(y, \mathsf{*.f64}\left(y, \frac{-1}{6}\right)\right)\right)\right)\right), \mathsf{+.f64}\left(z, \mathsf{*.f64}\left(\mathsf{*.f64}\left(y, \mathsf{*.f64}\left(y, z\right)\right), \mathsf{+.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(y, \mathsf{*.f64}\left(y, \color{blue}{\frac{1}{24}}\right)\right)\right)\right)\right)\right) \]
    8. Simplified100.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -6.2 \cdot 10^{+76}:\\ \;\;\;\;x + \sin y\\ \mathbf{elif}\;y \leq -165:\\ \;\;\;\;z \cdot \cos y\\ \mathbf{elif}\;y \leq 1.05:\\ \;\;\;\;\left(x + y \cdot \left(1 + y \cdot \left(y \cdot -0.16666666666666666\right)\right)\right) + \left(z + \left(y \cdot \left(y \cdot z\right)\right) \cdot \left(-0.5 + y \cdot \left(y \cdot 0.041666666666666664\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x + \sin y\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 99.4% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
t_0 := x + z \cdot \cos y\\
\mathbf{if}\;z \leq -1.25:\\
\;\;\;\;t\_0\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.25 or 1.8999999999999999 < z

    1. Initial program 99.9%

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

      \[\leadsto \mathsf{+.f64}\left(\color{blue}{x}, \mathsf{*.f64}\left(z, \mathsf{cos.f64}\left(y\right)\right)\right) \]
    4. Step-by-step derivation
      1. Simplified97.6%

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

      if -1.25 < z < 1.8999999999999999

      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 \mathsf{+.f64}\left(\mathsf{+.f64}\left(x, \mathsf{sin.f64}\left(y\right)\right), \color{blue}{z}\right) \]
      4. Step-by-step derivation
        1. Simplified99.6%

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

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

      Alternative 5: 94.5% accurate, 1.8× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := x + z \cdot \cos y\\ \mathbf{if}\;z \leq -6.8 \cdot 10^{-37}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{-81}:\\ \;\;\;\;x + \sin y\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
      (FPCore (x y z)
       :precision binary64
       (let* ((t_0 (+ x (* z (cos y)))))
         (if (<= z -6.8e-37) t_0 (if (<= z 1.9e-81) (+ x (sin y)) t_0))))
      double code(double x, double y, double z) {
      	double t_0 = x + (z * cos(y));
      	double tmp;
      	if (z <= -6.8e-37) {
      		tmp = t_0;
      	} else if (z <= 1.9e-81) {
      		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 = x + (z * cos(y))
          if (z <= (-6.8d-37)) then
              tmp = t_0
          else if (z <= 1.9d-81) 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 = x + (z * Math.cos(y));
      	double tmp;
      	if (z <= -6.8e-37) {
      		tmp = t_0;
      	} else if (z <= 1.9e-81) {
      		tmp = x + Math.sin(y);
      	} else {
      		tmp = t_0;
      	}
      	return tmp;
      }
      
      def code(x, y, z):
      	t_0 = x + (z * math.cos(y))
      	tmp = 0
      	if z <= -6.8e-37:
      		tmp = t_0
      	elif z <= 1.9e-81:
      		tmp = x + math.sin(y)
      	else:
      		tmp = t_0
      	return tmp
      
      function code(x, y, z)
      	t_0 = Float64(x + Float64(z * cos(y)))
      	tmp = 0.0
      	if (z <= -6.8e-37)
      		tmp = t_0;
      	elseif (z <= 1.9e-81)
      		tmp = Float64(x + sin(y));
      	else
      		tmp = t_0;
      	end
      	return tmp
      end
      
      function tmp_2 = code(x, y, z)
      	t_0 = x + (z * cos(y));
      	tmp = 0.0;
      	if (z <= -6.8e-37)
      		tmp = t_0;
      	elseif (z <= 1.9e-81)
      		tmp = x + sin(y);
      	else
      		tmp = t_0;
      	end
      	tmp_2 = tmp;
      end
      
      code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -6.8e-37], t$95$0, If[LessEqual[z, 1.9e-81], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], t$95$0]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := x + z \cdot \cos y\\
      \mathbf{if}\;z \leq -6.8 \cdot 10^{-37}:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;z \leq 1.9 \cdot 10^{-81}:\\
      \;\;\;\;x + \sin y\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_0\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if z < -6.80000000000000037e-37 or 1.8999999999999999e-81 < z

        1. Initial program 99.9%

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

          \[\leadsto \mathsf{+.f64}\left(\color{blue}{x}, \mathsf{*.f64}\left(z, \mathsf{cos.f64}\left(y\right)\right)\right) \]
        4. Step-by-step derivation
          1. Simplified94.9%

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

          if -6.80000000000000037e-37 < z < 1.8999999999999999e-81

          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 \sin y + \color{blue}{x} \]
            2. +-lowering-+.f64N/A

              \[\leadsto \mathsf{+.f64}\left(\sin y, \color{blue}{x}\right) \]
            3. sin-lowering-sin.f6492.7%

              \[\leadsto \mathsf{+.f64}\left(\mathsf{sin.f64}\left(y\right), x\right) \]
          5. Simplified92.7%

            \[\leadsto \color{blue}{\sin y + x} \]
        5. Recombined 2 regimes into one program.
        6. Final simplification94.0%

          \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -6.8 \cdot 10^{-37}:\\ \;\;\;\;x + z \cdot \cos y\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{-81}:\\ \;\;\;\;x + \sin y\\ \mathbf{else}:\\ \;\;\;\;x + z \cdot \cos y\\ \end{array} \]
        7. Add Preprocessing

        Alternative 6: 67.2% accurate, 1.9× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -130:\\ \;\;\;\;x + z\\ \mathbf{elif}\;y \leq 2.8 \cdot 10^{+41}:\\ \;\;\;\;\left(x + z\right) + y \cdot \left(1 + y \cdot \left(y \cdot -0.16666666666666666 + z \cdot -0.5\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sin y\\ \end{array} \end{array} \]
        (FPCore (x y z)
         :precision binary64
         (if (<= y -130.0)
           (+ x z)
           (if (<= y 2.8e+41)
             (+ (+ x z) (* y (+ 1.0 (* y (+ (* y -0.16666666666666666) (* z -0.5))))))
             (sin y))))
        double code(double x, double y, double z) {
        	double tmp;
        	if (y <= -130.0) {
        		tmp = x + z;
        	} else if (y <= 2.8e+41) {
        		tmp = (x + z) + (y * (1.0 + (y * ((y * -0.16666666666666666) + (z * -0.5)))));
        	} else {
        		tmp = sin(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 (y <= (-130.0d0)) then
                tmp = x + z
            else if (y <= 2.8d+41) then
                tmp = (x + z) + (y * (1.0d0 + (y * ((y * (-0.16666666666666666d0)) + (z * (-0.5d0))))))
            else
                tmp = sin(y)
            end if
            code = tmp
        end function
        
        public static double code(double x, double y, double z) {
        	double tmp;
        	if (y <= -130.0) {
        		tmp = x + z;
        	} else if (y <= 2.8e+41) {
        		tmp = (x + z) + (y * (1.0 + (y * ((y * -0.16666666666666666) + (z * -0.5)))));
        	} else {
        		tmp = Math.sin(y);
        	}
        	return tmp;
        }
        
        def code(x, y, z):
        	tmp = 0
        	if y <= -130.0:
        		tmp = x + z
        	elif y <= 2.8e+41:
        		tmp = (x + z) + (y * (1.0 + (y * ((y * -0.16666666666666666) + (z * -0.5)))))
        	else:
        		tmp = math.sin(y)
        	return tmp
        
        function code(x, y, z)
        	tmp = 0.0
        	if (y <= -130.0)
        		tmp = Float64(x + z);
        	elseif (y <= 2.8e+41)
        		tmp = Float64(Float64(x + z) + Float64(y * Float64(1.0 + Float64(y * Float64(Float64(y * -0.16666666666666666) + Float64(z * -0.5))))));
        	else
        		tmp = sin(y);
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y, z)
        	tmp = 0.0;
        	if (y <= -130.0)
        		tmp = x + z;
        	elseif (y <= 2.8e+41)
        		tmp = (x + z) + (y * (1.0 + (y * ((y * -0.16666666666666666) + (z * -0.5)))));
        	else
        		tmp = sin(y);
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_, z_] := If[LessEqual[y, -130.0], N[(x + z), $MachinePrecision], If[LessEqual[y, 2.8e+41], N[(N[(x + z), $MachinePrecision] + N[(y * N[(1.0 + N[(y * N[(N[(y * -0.16666666666666666), $MachinePrecision] + N[(z * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[y], $MachinePrecision]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;y \leq -130:\\
        \;\;\;\;x + z\\
        
        \mathbf{elif}\;y \leq 2.8 \cdot 10^{+41}:\\
        \;\;\;\;\left(x + z\right) + y \cdot \left(1 + y \cdot \left(y \cdot -0.16666666666666666 + z \cdot -0.5\right)\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;\sin y\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if y < -130

          1. Initial program 99.8%

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

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

              \[\leadsto z + \color{blue}{x} \]
            2. +-lowering-+.f6444.4%

              \[\leadsto \mathsf{+.f64}\left(z, \color{blue}{x}\right) \]
          5. Simplified44.4%

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

          if -130 < y < 2.7999999999999999e41

          1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \mathsf{+.f64}\left(\mathsf{+.f64}\left(z, x\right), \mathsf{*.f64}\left(y, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(y, \mathsf{+.f64}\left(\mathsf{*.f64}\left(z, \frac{-1}{2}\right), \left(y \cdot \color{blue}{\frac{-1}{6}}\right)\right)\right)\right)\right)\right) \]
            12. *-lowering-*.f6498.0%

              \[\leadsto \mathsf{+.f64}\left(\mathsf{+.f64}\left(z, x\right), \mathsf{*.f64}\left(y, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(y, \mathsf{+.f64}\left(\mathsf{*.f64}\left(z, \frac{-1}{2}\right), \mathsf{*.f64}\left(y, \color{blue}{\frac{-1}{6}}\right)\right)\right)\right)\right)\right) \]
          5. Simplified98.0%

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

          if 2.7999999999999999e41 < y

          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 \sin y + \color{blue}{x} \]
            2. +-lowering-+.f64N/A

              \[\leadsto \mathsf{+.f64}\left(\sin y, \color{blue}{x}\right) \]
            3. sin-lowering-sin.f6462.7%

              \[\leadsto \mathsf{+.f64}\left(\mathsf{sin.f64}\left(y\right), x\right) \]
          5. Simplified62.7%

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

            \[\leadsto \color{blue}{\sin y} \]
          7. Step-by-step derivation
            1. sin-lowering-sin.f6441.4%

              \[\leadsto \mathsf{sin.f64}\left(y\right) \]
          8. Simplified41.4%

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -130:\\ \;\;\;\;x + z\\ \mathbf{elif}\;y \leq 2.8 \cdot 10^{+41}:\\ \;\;\;\;\left(x + z\right) + y \cdot \left(1 + y \cdot \left(y \cdot -0.16666666666666666 + z \cdot -0.5\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sin y\\ \end{array} \]
        5. Add Preprocessing

        Alternative 7: 70.9% accurate, 7.7× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -180:\\ \;\;\;\;x + z\\ \mathbf{elif}\;y \leq 17000000000000:\\ \;\;\;\;\left(x + z\right) + y \cdot \left(1 + y \cdot \left(y \cdot -0.16666666666666666 + z \cdot -0.5\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x + z\\ \end{array} \end{array} \]
        (FPCore (x y z)
         :precision binary64
         (if (<= y -180.0)
           (+ x z)
           (if (<= y 17000000000000.0)
             (+ (+ x z) (* y (+ 1.0 (* y (+ (* y -0.16666666666666666) (* z -0.5))))))
             (+ x z))))
        double code(double x, double y, double z) {
        	double tmp;
        	if (y <= -180.0) {
        		tmp = x + z;
        	} else if (y <= 17000000000000.0) {
        		tmp = (x + z) + (y * (1.0 + (y * ((y * -0.16666666666666666) + (z * -0.5)))));
        	} else {
        		tmp = x + z;
        	}
        	return tmp;
        }
        
        real(8) function code(x, y, z)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            real(8), intent (in) :: z
            real(8) :: tmp
            if (y <= (-180.0d0)) then
                tmp = x + z
            else if (y <= 17000000000000.0d0) then
                tmp = (x + z) + (y * (1.0d0 + (y * ((y * (-0.16666666666666666d0)) + (z * (-0.5d0))))))
            else
                tmp = x + z
            end if
            code = tmp
        end function
        
        public static double code(double x, double y, double z) {
        	double tmp;
        	if (y <= -180.0) {
        		tmp = x + z;
        	} else if (y <= 17000000000000.0) {
        		tmp = (x + z) + (y * (1.0 + (y * ((y * -0.16666666666666666) + (z * -0.5)))));
        	} else {
        		tmp = x + z;
        	}
        	return tmp;
        }
        
        def code(x, y, z):
        	tmp = 0
        	if y <= -180.0:
        		tmp = x + z
        	elif y <= 17000000000000.0:
        		tmp = (x + z) + (y * (1.0 + (y * ((y * -0.16666666666666666) + (z * -0.5)))))
        	else:
        		tmp = x + z
        	return tmp
        
        function code(x, y, z)
        	tmp = 0.0
        	if (y <= -180.0)
        		tmp = Float64(x + z);
        	elseif (y <= 17000000000000.0)
        		tmp = Float64(Float64(x + z) + Float64(y * Float64(1.0 + Float64(y * Float64(Float64(y * -0.16666666666666666) + Float64(z * -0.5))))));
        	else
        		tmp = Float64(x + z);
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y, z)
        	tmp = 0.0;
        	if (y <= -180.0)
        		tmp = x + z;
        	elseif (y <= 17000000000000.0)
        		tmp = (x + z) + (y * (1.0 + (y * ((y * -0.16666666666666666) + (z * -0.5)))));
        	else
        		tmp = x + z;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_, z_] := If[LessEqual[y, -180.0], N[(x + z), $MachinePrecision], If[LessEqual[y, 17000000000000.0], N[(N[(x + z), $MachinePrecision] + N[(y * N[(1.0 + N[(y * N[(N[(y * -0.16666666666666666), $MachinePrecision] + N[(z * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + z), $MachinePrecision]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;y \leq -180:\\
        \;\;\;\;x + z\\
        
        \mathbf{elif}\;y \leq 17000000000000:\\
        \;\;\;\;\left(x + z\right) + y \cdot \left(1 + y \cdot \left(y \cdot -0.16666666666666666 + z \cdot -0.5\right)\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;x + z\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if y < -180 or 1.7e13 < 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 z + \color{blue}{x} \]
            2. +-lowering-+.f6437.5%

              \[\leadsto \mathsf{+.f64}\left(z, \color{blue}{x}\right) \]
          5. Simplified37.5%

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

          if -180 < y < 1.7e13

          1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \mathsf{+.f64}\left(\mathsf{+.f64}\left(z, x\right), \mathsf{*.f64}\left(y, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(y, \mathsf{+.f64}\left(\mathsf{*.f64}\left(z, \frac{-1}{2}\right), \left(y \cdot \color{blue}{\frac{-1}{6}}\right)\right)\right)\right)\right)\right) \]
            12. *-lowering-*.f6499.3%

              \[\leadsto \mathsf{+.f64}\left(\mathsf{+.f64}\left(z, x\right), \mathsf{*.f64}\left(y, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(y, \mathsf{+.f64}\left(\mathsf{*.f64}\left(z, \frac{-1}{2}\right), \mathsf{*.f64}\left(y, \color{blue}{\frac{-1}{6}}\right)\right)\right)\right)\right)\right) \]
          5. Simplified99.3%

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -180:\\ \;\;\;\;x + z\\ \mathbf{elif}\;y \leq 17000000000000:\\ \;\;\;\;\left(x + z\right) + y \cdot \left(1 + y \cdot \left(y \cdot -0.16666666666666666 + z \cdot -0.5\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x + z\\ \end{array} \]
        5. Add Preprocessing

        Alternative 8: 70.9% accurate, 9.0× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -160:\\ \;\;\;\;x + z\\ \mathbf{elif}\;y \leq 1200000000000:\\ \;\;\;\;\left(x + y\right) + z \cdot \left(1 + y \cdot \left(y \cdot -0.5\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x + z\\ \end{array} \end{array} \]
        (FPCore (x y z)
         :precision binary64
         (if (<= y -160.0)
           (+ x z)
           (if (<= y 1200000000000.0)
             (+ (+ x y) (* z (+ 1.0 (* y (* y -0.5)))))
             (+ x z))))
        double code(double x, double y, double z) {
        	double tmp;
        	if (y <= -160.0) {
        		tmp = x + z;
        	} else if (y <= 1200000000000.0) {
        		tmp = (x + y) + (z * (1.0 + (y * (y * -0.5))));
        	} else {
        		tmp = x + z;
        	}
        	return tmp;
        }
        
        real(8) function code(x, y, z)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            real(8), intent (in) :: z
            real(8) :: tmp
            if (y <= (-160.0d0)) then
                tmp = x + z
            else if (y <= 1200000000000.0d0) then
                tmp = (x + y) + (z * (1.0d0 + (y * (y * (-0.5d0)))))
            else
                tmp = x + z
            end if
            code = tmp
        end function
        
        public static double code(double x, double y, double z) {
        	double tmp;
        	if (y <= -160.0) {
        		tmp = x + z;
        	} else if (y <= 1200000000000.0) {
        		tmp = (x + y) + (z * (1.0 + (y * (y * -0.5))));
        	} else {
        		tmp = x + z;
        	}
        	return tmp;
        }
        
        def code(x, y, z):
        	tmp = 0
        	if y <= -160.0:
        		tmp = x + z
        	elif y <= 1200000000000.0:
        		tmp = (x + y) + (z * (1.0 + (y * (y * -0.5))))
        	else:
        		tmp = x + z
        	return tmp
        
        function code(x, y, z)
        	tmp = 0.0
        	if (y <= -160.0)
        		tmp = Float64(x + z);
        	elseif (y <= 1200000000000.0)
        		tmp = Float64(Float64(x + y) + Float64(z * Float64(1.0 + Float64(y * Float64(y * -0.5)))));
        	else
        		tmp = Float64(x + z);
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y, z)
        	tmp = 0.0;
        	if (y <= -160.0)
        		tmp = x + z;
        	elseif (y <= 1200000000000.0)
        		tmp = (x + y) + (z * (1.0 + (y * (y * -0.5))));
        	else
        		tmp = x + z;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_, z_] := If[LessEqual[y, -160.0], N[(x + z), $MachinePrecision], If[LessEqual[y, 1200000000000.0], N[(N[(x + y), $MachinePrecision] + N[(z * N[(1.0 + N[(y * N[(y * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + z), $MachinePrecision]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;y \leq -160:\\
        \;\;\;\;x + z\\
        
        \mathbf{elif}\;y \leq 1200000000000:\\
        \;\;\;\;\left(x + y\right) + z \cdot \left(1 + y \cdot \left(y \cdot -0.5\right)\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;x + z\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if y < -160 or 1.2e12 < 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 z + \color{blue}{x} \]
            2. +-lowering-+.f6437.5%

              \[\leadsto \mathsf{+.f64}\left(z, \color{blue}{x}\right) \]
          5. Simplified37.5%

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

          if -160 < y < 1.2e12

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \mathsf{+.f64}\left(\mathsf{+.f64}\left(y, x\right), \mathsf{*.f64}\left(z, \mathsf{+.f64}\left(1, \left(\frac{-1}{2} \cdot \left(y \cdot \color{blue}{y}\right)\right)\right)\right)\right) \]
          5. Simplified99.3%

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

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

        Alternative 9: 70.9% accurate, 9.0× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -7000:\\ \;\;\;\;x + z\\ \mathbf{elif}\;y \leq 1200000000000:\\ \;\;\;\;z + \left(x + y \cdot \left(1 + y \cdot \left(y \cdot -0.16666666666666666\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x + z\\ \end{array} \end{array} \]
        (FPCore (x y z)
         :precision binary64
         (if (<= y -7000.0)
           (+ x z)
           (if (<= y 1200000000000.0)
             (+ z (+ x (* y (+ 1.0 (* y (* y -0.16666666666666666))))))
             (+ x z))))
        double code(double x, double y, double z) {
        	double tmp;
        	if (y <= -7000.0) {
        		tmp = x + z;
        	} else if (y <= 1200000000000.0) {
        		tmp = z + (x + (y * (1.0 + (y * (y * -0.16666666666666666)))));
        	} else {
        		tmp = x + z;
        	}
        	return tmp;
        }
        
        real(8) function code(x, y, z)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            real(8), intent (in) :: z
            real(8) :: tmp
            if (y <= (-7000.0d0)) then
                tmp = x + z
            else if (y <= 1200000000000.0d0) then
                tmp = z + (x + (y * (1.0d0 + (y * (y * (-0.16666666666666666d0))))))
            else
                tmp = x + z
            end if
            code = tmp
        end function
        
        public static double code(double x, double y, double z) {
        	double tmp;
        	if (y <= -7000.0) {
        		tmp = x + z;
        	} else if (y <= 1200000000000.0) {
        		tmp = z + (x + (y * (1.0 + (y * (y * -0.16666666666666666)))));
        	} else {
        		tmp = x + z;
        	}
        	return tmp;
        }
        
        def code(x, y, z):
        	tmp = 0
        	if y <= -7000.0:
        		tmp = x + z
        	elif y <= 1200000000000.0:
        		tmp = z + (x + (y * (1.0 + (y * (y * -0.16666666666666666)))))
        	else:
        		tmp = x + z
        	return tmp
        
        function code(x, y, z)
        	tmp = 0.0
        	if (y <= -7000.0)
        		tmp = Float64(x + z);
        	elseif (y <= 1200000000000.0)
        		tmp = Float64(z + Float64(x + Float64(y * Float64(1.0 + Float64(y * Float64(y * -0.16666666666666666))))));
        	else
        		tmp = Float64(x + z);
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y, z)
        	tmp = 0.0;
        	if (y <= -7000.0)
        		tmp = x + z;
        	elseif (y <= 1200000000000.0)
        		tmp = z + (x + (y * (1.0 + (y * (y * -0.16666666666666666)))));
        	else
        		tmp = x + z;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_, z_] := If[LessEqual[y, -7000.0], N[(x + z), $MachinePrecision], If[LessEqual[y, 1200000000000.0], N[(z + N[(x + N[(y * N[(1.0 + N[(y * N[(y * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + z), $MachinePrecision]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;y \leq -7000:\\
        \;\;\;\;x + z\\
        
        \mathbf{elif}\;y \leq 1200000000000:\\
        \;\;\;\;z + \left(x + y \cdot \left(1 + y \cdot \left(y \cdot -0.16666666666666666\right)\right)\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;x + z\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if y < -7e3 or 1.2e12 < 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 z + \color{blue}{x} \]
            2. +-lowering-+.f6437.7%

              \[\leadsto \mathsf{+.f64}\left(z, \color{blue}{x}\right) \]
          5. Simplified37.7%

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

          if -7e3 < y < 1.2e12

          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 \mathsf{+.f64}\left(\color{blue}{\left(x + y \cdot \left(1 + \frac{-1}{6} \cdot {y}^{2}\right)\right)}, \mathsf{*.f64}\left(z, \mathsf{cos.f64}\left(y\right)\right)\right) \]
          4. Step-by-step derivation
            1. +-lowering-+.f64N/A

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

              \[\leadsto \mathsf{+.f64}\left(\mathsf{+.f64}\left(x, \mathsf{*.f64}\left(y, \left(1 + \frac{-1}{6} \cdot {y}^{2}\right)\right)\right), \mathsf{*.f64}\left(z, \mathsf{cos.f64}\left(y\right)\right)\right) \]
            3. +-lowering-+.f64N/A

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

              \[\leadsto \mathsf{+.f64}\left(\mathsf{+.f64}\left(x, \mathsf{*.f64}\left(y, \mathsf{+.f64}\left(1, \left(\frac{-1}{6} \cdot \left(y \cdot y\right)\right)\right)\right)\right), \mathsf{*.f64}\left(z, \mathsf{cos.f64}\left(y\right)\right)\right) \]
            5. associate-*r*N/A

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

              \[\leadsto \mathsf{+.f64}\left(\mathsf{+.f64}\left(x, \mathsf{*.f64}\left(y, \mathsf{+.f64}\left(1, \left(y \cdot \left(\frac{-1}{6} \cdot y\right)\right)\right)\right)\right), \mathsf{*.f64}\left(z, \mathsf{cos.f64}\left(y\right)\right)\right) \]
            7. *-lowering-*.f64N/A

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

              \[\leadsto \mathsf{+.f64}\left(\mathsf{+.f64}\left(x, \mathsf{*.f64}\left(y, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(y, \left(y \cdot \frac{-1}{6}\right)\right)\right)\right)\right), \mathsf{*.f64}\left(z, \mathsf{cos.f64}\left(y\right)\right)\right) \]
            9. *-lowering-*.f6499.3%

              \[\leadsto \mathsf{+.f64}\left(\mathsf{+.f64}\left(x, \mathsf{*.f64}\left(y, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(y, \mathsf{*.f64}\left(y, \frac{-1}{6}\right)\right)\right)\right)\right), \mathsf{*.f64}\left(z, \mathsf{cos.f64}\left(y\right)\right)\right) \]
          5. Simplified99.3%

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

            \[\leadsto \mathsf{+.f64}\left(\mathsf{+.f64}\left(x, \mathsf{*.f64}\left(y, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(y, \mathsf{*.f64}\left(y, \frac{-1}{6}\right)\right)\right)\right)\right), \color{blue}{z}\right) \]
          7. Step-by-step derivation
            1. Simplified98.4%

              \[\leadsto \left(x + y \cdot \left(1 + y \cdot \left(y \cdot -0.16666666666666666\right)\right)\right) + \color{blue}{z} \]
          8. Recombined 2 regimes into one program.
          9. Final simplification70.2%

            \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -7000:\\ \;\;\;\;x + z\\ \mathbf{elif}\;y \leq 1200000000000:\\ \;\;\;\;z + \left(x + y \cdot \left(1 + y \cdot \left(y \cdot -0.16666666666666666\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x + z\\ \end{array} \]
          10. Add Preprocessing

          Alternative 10: 70.8% accurate, 13.8× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -7 \cdot 10^{+46}:\\ \;\;\;\;x + z\\ \mathbf{elif}\;y \leq 3.2:\\ \;\;\;\;z + \left(x + y\right)\\ \mathbf{else}:\\ \;\;\;\;x + z\\ \end{array} \end{array} \]
          (FPCore (x y z)
           :precision binary64
           (if (<= y -7e+46) (+ x z) (if (<= y 3.2) (+ z (+ x y)) (+ x z))))
          double code(double x, double y, double z) {
          	double tmp;
          	if (y <= -7e+46) {
          		tmp = x + z;
          	} else if (y <= 3.2) {
          		tmp = z + (x + y);
          	} else {
          		tmp = x + z;
          	}
          	return tmp;
          }
          
          real(8) function code(x, y, z)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              real(8), intent (in) :: z
              real(8) :: tmp
              if (y <= (-7d+46)) then
                  tmp = x + z
              else if (y <= 3.2d0) then
                  tmp = z + (x + y)
              else
                  tmp = x + z
              end if
              code = tmp
          end function
          
          public static double code(double x, double y, double z) {
          	double tmp;
          	if (y <= -7e+46) {
          		tmp = x + z;
          	} else if (y <= 3.2) {
          		tmp = z + (x + y);
          	} else {
          		tmp = x + z;
          	}
          	return tmp;
          }
          
          def code(x, y, z):
          	tmp = 0
          	if y <= -7e+46:
          		tmp = x + z
          	elif y <= 3.2:
          		tmp = z + (x + y)
          	else:
          		tmp = x + z
          	return tmp
          
          function code(x, y, z)
          	tmp = 0.0
          	if (y <= -7e+46)
          		tmp = Float64(x + z);
          	elseif (y <= 3.2)
          		tmp = Float64(z + Float64(x + y));
          	else
          		tmp = Float64(x + z);
          	end
          	return tmp
          end
          
          function tmp_2 = code(x, y, z)
          	tmp = 0.0;
          	if (y <= -7e+46)
          		tmp = x + z;
          	elseif (y <= 3.2)
          		tmp = z + (x + y);
          	else
          		tmp = x + z;
          	end
          	tmp_2 = tmp;
          end
          
          code[x_, y_, z_] := If[LessEqual[y, -7e+46], N[(x + z), $MachinePrecision], If[LessEqual[y, 3.2], N[(z + N[(x + y), $MachinePrecision]), $MachinePrecision], N[(x + z), $MachinePrecision]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;y \leq -7 \cdot 10^{+46}:\\
          \;\;\;\;x + z\\
          
          \mathbf{elif}\;y \leq 3.2:\\
          \;\;\;\;z + \left(x + y\right)\\
          
          \mathbf{else}:\\
          \;\;\;\;x + z\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if y < -6.9999999999999997e46 or 3.2000000000000002 < 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 z + \color{blue}{x} \]
              2. +-lowering-+.f6438.0%

                \[\leadsto \mathsf{+.f64}\left(z, \color{blue}{x}\right) \]
            5. Simplified38.0%

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

            if -6.9999999999999997e46 < y < 3.2000000000000002

            1. Initial program 100.0%

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

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

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

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

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

                \[\leadsto \mathsf{+.f64}\left(z, \left(y + \color{blue}{x}\right)\right) \]
              5. +-lowering-+.f6497.2%

                \[\leadsto \mathsf{+.f64}\left(z, \mathsf{+.f64}\left(y, \color{blue}{x}\right)\right) \]
            5. Simplified97.2%

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

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

          Alternative 11: 55.8% accurate, 18.8× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -75:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 130000000:\\ \;\;\;\;z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
          (FPCore (x y z)
           :precision binary64
           (if (<= x -75.0) x (if (<= x 130000000.0) z x)))
          double code(double x, double y, double z) {
          	double tmp;
          	if (x <= -75.0) {
          		tmp = x;
          	} else if (x <= 130000000.0) {
          		tmp = z;
          	} else {
          		tmp = 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 <= (-75.0d0)) then
                  tmp = x
              else if (x <= 130000000.0d0) then
                  tmp = z
              else
                  tmp = x
              end if
              code = tmp
          end function
          
          public static double code(double x, double y, double z) {
          	double tmp;
          	if (x <= -75.0) {
          		tmp = x;
          	} else if (x <= 130000000.0) {
          		tmp = z;
          	} else {
          		tmp = x;
          	}
          	return tmp;
          }
          
          def code(x, y, z):
          	tmp = 0
          	if x <= -75.0:
          		tmp = x
          	elif x <= 130000000.0:
          		tmp = z
          	else:
          		tmp = x
          	return tmp
          
          function code(x, y, z)
          	tmp = 0.0
          	if (x <= -75.0)
          		tmp = x;
          	elseif (x <= 130000000.0)
          		tmp = z;
          	else
          		tmp = x;
          	end
          	return tmp
          end
          
          function tmp_2 = code(x, y, z)
          	tmp = 0.0;
          	if (x <= -75.0)
          		tmp = x;
          	elseif (x <= 130000000.0)
          		tmp = z;
          	else
          		tmp = x;
          	end
          	tmp_2 = tmp;
          end
          
          code[x_, y_, z_] := If[LessEqual[x, -75.0], x, If[LessEqual[x, 130000000.0], z, x]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;x \leq -75:\\
          \;\;\;\;x\\
          
          \mathbf{elif}\;x \leq 130000000:\\
          \;\;\;\;z\\
          
          \mathbf{else}:\\
          \;\;\;\;x\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if x < -75 or 1.3e8 < x

            1. Initial program 100.0%

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

              \[\leadsto \color{blue}{x} \]
            4. Step-by-step derivation
              1. Simplified80.6%

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

              if -75 < x < 1.3e8

              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 \mathsf{+.f64}\left(\mathsf{+.f64}\left(x, \mathsf{sin.f64}\left(y\right)\right), \color{blue}{z}\right) \]
              4. Step-by-step derivation
                1. Simplified79.4%

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

                  \[\leadsto \color{blue}{z} \]
                3. Step-by-step derivation
                  1. Simplified40.4%

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

                Alternative 12: 44.7% accurate, 18.8× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2.1 \cdot 10^{-106}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 6.8 \cdot 10^{-133}:\\ \;\;\;\;y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
                (FPCore (x y z)
                 :precision binary64
                 (if (<= x -2.1e-106) x (if (<= x 6.8e-133) y x)))
                double code(double x, double y, double z) {
                	double tmp;
                	if (x <= -2.1e-106) {
                		tmp = x;
                	} else if (x <= 6.8e-133) {
                		tmp = y;
                	} else {
                		tmp = 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 <= (-2.1d-106)) then
                        tmp = x
                    else if (x <= 6.8d-133) then
                        tmp = y
                    else
                        tmp = x
                    end if
                    code = tmp
                end function
                
                public static double code(double x, double y, double z) {
                	double tmp;
                	if (x <= -2.1e-106) {
                		tmp = x;
                	} else if (x <= 6.8e-133) {
                		tmp = y;
                	} else {
                		tmp = x;
                	}
                	return tmp;
                }
                
                def code(x, y, z):
                	tmp = 0
                	if x <= -2.1e-106:
                		tmp = x
                	elif x <= 6.8e-133:
                		tmp = y
                	else:
                		tmp = x
                	return tmp
                
                function code(x, y, z)
                	tmp = 0.0
                	if (x <= -2.1e-106)
                		tmp = x;
                	elseif (x <= 6.8e-133)
                		tmp = y;
                	else
                		tmp = x;
                	end
                	return tmp
                end
                
                function tmp_2 = code(x, y, z)
                	tmp = 0.0;
                	if (x <= -2.1e-106)
                		tmp = x;
                	elseif (x <= 6.8e-133)
                		tmp = y;
                	else
                		tmp = x;
                	end
                	tmp_2 = tmp;
                end
                
                code[x_, y_, z_] := If[LessEqual[x, -2.1e-106], x, If[LessEqual[x, 6.8e-133], y, x]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                \mathbf{if}\;x \leq -2.1 \cdot 10^{-106}:\\
                \;\;\;\;x\\
                
                \mathbf{elif}\;x \leq 6.8 \cdot 10^{-133}:\\
                \;\;\;\;y\\
                
                \mathbf{else}:\\
                \;\;\;\;x\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if x < -2.10000000000000003e-106 or 6.80000000000000012e-133 < x

                  1. Initial program 100.0%

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

                    \[\leadsto \color{blue}{x} \]
                  4. Step-by-step derivation
                    1. Simplified57.9%

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

                    if -2.10000000000000003e-106 < x < 6.80000000000000012e-133

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \mathsf{+.f64}\left(\mathsf{+.f64}\left(y, x\right), \mathsf{*.f64}\left(z, \mathsf{+.f64}\left(1, \left(\frac{-1}{2} \cdot \left(y \cdot \color{blue}{y}\right)\right)\right)\right)\right) \]
                    5. Simplified56.3%

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

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

                        \[\leadsto y + \color{blue}{x} \]
                      2. +-lowering-+.f6418.9%

                        \[\leadsto \mathsf{+.f64}\left(y, \color{blue}{x}\right) \]
                    8. Simplified18.9%

                      \[\leadsto \color{blue}{y + x} \]
                    9. Taylor expanded in y around inf

                      \[\leadsto \color{blue}{y} \]
                    10. Step-by-step derivation
                      1. Simplified16.8%

                        \[\leadsto \color{blue}{y} \]
                    11. Recombined 2 regimes into one program.
                    12. Add Preprocessing

                    Alternative 13: 66.8% accurate, 69.0× speedup?

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

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

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

                        \[\leadsto z + \color{blue}{x} \]
                      2. +-lowering-+.f6464.9%

                        \[\leadsto \mathsf{+.f64}\left(z, \color{blue}{x}\right) \]
                    5. Simplified64.9%

                      \[\leadsto \color{blue}{z + x} \]
                    6. Final simplification64.9%

                      \[\leadsto x + z \]
                    7. Add Preprocessing

                    Alternative 14: 42.5% accurate, 207.0× speedup?

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

                      \[\leadsto \color{blue}{x} \]
                    4. Step-by-step derivation
                      1. Simplified40.7%

                        \[\leadsto \color{blue}{x} \]
                      2. Add Preprocessing

                      Reproduce

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