Toniolo and Linder, Equation (3b), real

Percentage Accurate: 94.5% → 99.7%
Time: 13.0s
Alternatives: 23
Speedup: 1.4×

Specification

?
\[\begin{array}{l} \\ \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \end{array} \]
(FPCore (kx ky th)
 :precision binary64
 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
	return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
    real(8), intent (in) :: kx
    real(8), intent (in) :: ky
    real(8), intent (in) :: th
    code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
	return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th):
	return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th)
	return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th))
end
function tmp = code(kx, ky, th)
	tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th);
end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\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 23 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: 94.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \end{array} \]
(FPCore (kx ky th)
 :precision binary64
 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
	return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
    real(8), intent (in) :: kx
    real(8), intent (in) :: ky
    real(8), intent (in) :: th
    code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
	return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th):
	return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th)
	return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th))
end
function tmp = code(kx, ky, th)
	tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th);
end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}

Alternative 1: 99.7% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \frac{\sin th}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{\sin ky}} \end{array} \]
(FPCore (kx ky th)
 :precision binary64
 (/ (sin th) (/ (hypot (sin kx) (sin ky)) (sin ky))))
double code(double kx, double ky, double th) {
	return sin(th) / (hypot(sin(kx), sin(ky)) / sin(ky));
}
public static double code(double kx, double ky, double th) {
	return Math.sin(th) / (Math.hypot(Math.sin(kx), Math.sin(ky)) / Math.sin(ky));
}
def code(kx, ky, th):
	return math.sin(th) / (math.hypot(math.sin(kx), math.sin(ky)) / math.sin(ky))
function code(kx, ky, th)
	return Float64(sin(th) / Float64(hypot(sin(kx), sin(ky)) / sin(ky)))
end
function tmp = code(kx, ky, th)
	tmp = sin(th) / (hypot(sin(kx), sin(ky)) / sin(ky));
end
code[kx_, ky_, th_] := N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{\sin ky}}
\end{array}
Derivation
  1. Initial program 90.8%

    \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto \sin th \cdot \color{blue}{\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
    2. clear-numN/A

      \[\leadsto \sin th \cdot \frac{1}{\color{blue}{\frac{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}{\sin ky}}} \]
    3. un-div-invN/A

      \[\leadsto \frac{\sin th}{\color{blue}{\frac{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}{\sin ky}}} \]
    4. /-lowering-/.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\sin th, \color{blue}{\left(\frac{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}{\sin ky}\right)}\right) \]
    5. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \left(\frac{\color{blue}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}}{\sin ky}\right)\right) \]
    6. /-lowering-/.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right), \color{blue}{\sin ky}\right)\right) \]
    7. unpow2N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sqrt{\sin kx \cdot \sin kx + {\sin ky}^{2}}\right), \sin ky\right)\right) \]
    8. unpow2N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sqrt{\sin kx \cdot \sin kx + \sin ky \cdot \sin ky}\right), \sin ky\right)\right) \]
    9. accelerator-lowering-hypot.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\sin kx, \sin ky\right), \sin \color{blue}{ky}\right)\right) \]
    10. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \sin ky\right), \sin ky\right)\right) \]
    11. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right), \sin ky\right)\right) \]
    12. sin-lowering-sin.f6499.6%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right), \mathsf{sin.f64}\left(ky\right)\right)\right) \]
  4. Applied egg-rr99.6%

    \[\leadsto \color{blue}{\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{\sin ky}}} \]
  5. Add Preprocessing

Alternative 2: 45.7% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\sin ky \leq -0.1:\\ \;\;\;\;\frac{th}{\frac{\mathsf{hypot}\left(kx, \sin ky\right)}{\sin ky}}\\ \mathbf{elif}\;\sin ky \leq 10^{-29}:\\ \;\;\;\;\frac{\sin th}{\frac{\sin kx}{\sin ky}}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \end{array} \]
(FPCore (kx ky th)
 :precision binary64
 (if (<= (sin ky) -0.1)
   (/ th (/ (hypot kx (sin ky)) (sin ky)))
   (if (<= (sin ky) 1e-29) (/ (sin th) (/ (sin kx) (sin ky))) (sin th))))
double code(double kx, double ky, double th) {
	double tmp;
	if (sin(ky) <= -0.1) {
		tmp = th / (hypot(kx, sin(ky)) / sin(ky));
	} else if (sin(ky) <= 1e-29) {
		tmp = sin(th) / (sin(kx) / sin(ky));
	} else {
		tmp = sin(th);
	}
	return tmp;
}
public static double code(double kx, double ky, double th) {
	double tmp;
	if (Math.sin(ky) <= -0.1) {
		tmp = th / (Math.hypot(kx, Math.sin(ky)) / Math.sin(ky));
	} else if (Math.sin(ky) <= 1e-29) {
		tmp = Math.sin(th) / (Math.sin(kx) / Math.sin(ky));
	} else {
		tmp = Math.sin(th);
	}
	return tmp;
}
def code(kx, ky, th):
	tmp = 0
	if math.sin(ky) <= -0.1:
		tmp = th / (math.hypot(kx, math.sin(ky)) / math.sin(ky))
	elif math.sin(ky) <= 1e-29:
		tmp = math.sin(th) / (math.sin(kx) / math.sin(ky))
	else:
		tmp = math.sin(th)
	return tmp
function code(kx, ky, th)
	tmp = 0.0
	if (sin(ky) <= -0.1)
		tmp = Float64(th / Float64(hypot(kx, sin(ky)) / sin(ky)));
	elseif (sin(ky) <= 1e-29)
		tmp = Float64(sin(th) / Float64(sin(kx) / sin(ky)));
	else
		tmp = sin(th);
	end
	return tmp
end
function tmp_2 = code(kx, ky, th)
	tmp = 0.0;
	if (sin(ky) <= -0.1)
		tmp = th / (hypot(kx, sin(ky)) / sin(ky));
	elseif (sin(ky) <= 1e-29)
		tmp = sin(th) / (sin(kx) / sin(ky));
	else
		tmp = sin(th);
	end
	tmp_2 = tmp;
end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.1], N[(th / N[(N[Sqrt[kx ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-29], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.1:\\
\;\;\;\;\frac{th}{\frac{\mathsf{hypot}\left(kx, \sin ky\right)}{\sin ky}}\\

\mathbf{elif}\;\sin ky \leq 10^{-29}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{\sin ky}}\\

\mathbf{else}:\\
\;\;\;\;\sin th\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (sin.f64 ky) < -0.10000000000000001

    1. Initial program 99.7%

      \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \sin th \cdot \color{blue}{\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
      2. clear-numN/A

        \[\leadsto \sin th \cdot \frac{1}{\color{blue}{\frac{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}{\sin ky}}} \]
      3. un-div-invN/A

        \[\leadsto \frac{\sin th}{\color{blue}{\frac{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}{\sin ky}}} \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\sin th, \color{blue}{\left(\frac{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}{\sin ky}\right)}\right) \]
      5. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \left(\frac{\color{blue}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}}{\sin ky}\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right), \color{blue}{\sin ky}\right)\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sqrt{\sin kx \cdot \sin kx + {\sin ky}^{2}}\right), \sin ky\right)\right) \]
      8. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sqrt{\sin kx \cdot \sin kx + \sin ky \cdot \sin ky}\right), \sin ky\right)\right) \]
      9. accelerator-lowering-hypot.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\sin kx, \sin ky\right), \sin \color{blue}{ky}\right)\right) \]
      10. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \sin ky\right), \sin ky\right)\right) \]
      11. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right), \sin ky\right)\right) \]
      12. sin-lowering-sin.f6499.7%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right), \mathsf{sin.f64}\left(ky\right)\right)\right) \]
    4. Applied egg-rr99.7%

      \[\leadsto \color{blue}{\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{\sin ky}}} \]
    5. Taylor expanded in th around 0

      \[\leadsto \mathsf{/.f64}\left(\color{blue}{th}, \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right), \mathsf{sin.f64}\left(ky\right)\right)\right) \]
    6. Step-by-step derivation
      1. Simplified60.4%

        \[\leadsto \frac{\color{blue}{th}}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{\sin ky}} \]
      2. Taylor expanded in kx around 0

        \[\leadsto \mathsf{/.f64}\left(th, \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\color{blue}{kx}, \mathsf{sin.f64}\left(ky\right)\right), \mathsf{sin.f64}\left(ky\right)\right)\right) \]
      3. Step-by-step derivation
        1. Simplified30.5%

          \[\leadsto \frac{th}{\frac{\mathsf{hypot}\left(\color{blue}{kx}, \sin ky\right)}{\sin ky}} \]

        if -0.10000000000000001 < (sin.f64 ky) < 9.99999999999999943e-30

        1. Initial program 82.8%

          \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
        2. Add Preprocessing
        3. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto \sin th \cdot \color{blue}{\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
          2. clear-numN/A

            \[\leadsto \sin th \cdot \frac{1}{\color{blue}{\frac{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}{\sin ky}}} \]
          3. un-div-invN/A

            \[\leadsto \frac{\sin th}{\color{blue}{\frac{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}{\sin ky}}} \]
          4. /-lowering-/.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\sin th, \color{blue}{\left(\frac{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}{\sin ky}\right)}\right) \]
          5. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \left(\frac{\color{blue}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}}{\sin ky}\right)\right) \]
          6. /-lowering-/.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right), \color{blue}{\sin ky}\right)\right) \]
          7. unpow2N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sqrt{\sin kx \cdot \sin kx + {\sin ky}^{2}}\right), \sin ky\right)\right) \]
          8. unpow2N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sqrt{\sin kx \cdot \sin kx + \sin ky \cdot \sin ky}\right), \sin ky\right)\right) \]
          9. accelerator-lowering-hypot.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\sin kx, \sin ky\right), \sin \color{blue}{ky}\right)\right) \]
          10. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \sin ky\right), \sin ky\right)\right) \]
          11. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right), \sin ky\right)\right) \]
          12. sin-lowering-sin.f6499.7%

            \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right), \mathsf{sin.f64}\left(ky\right)\right)\right) \]
        4. Applied egg-rr99.7%

          \[\leadsto \color{blue}{\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{\sin ky}}} \]
        5. Taylor expanded in ky around 0

          \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\color{blue}{\sin kx}, \mathsf{sin.f64}\left(ky\right)\right)\right) \]
        6. Step-by-step derivation
          1. sin-lowering-sin.f6444.3%

            \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(\color{blue}{ky}\right)\right)\right) \]
        7. Simplified44.3%

          \[\leadsto \frac{\sin th}{\frac{\color{blue}{\sin kx}}{\sin ky}} \]

        if 9.99999999999999943e-30 < (sin.f64 ky)

        1. Initial program 99.6%

          \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
        2. Add Preprocessing
        3. Taylor expanded in kx around 0

          \[\leadsto \color{blue}{\sin th} \]
        4. Step-by-step derivation
          1. sin-lowering-sin.f6448.4%

            \[\leadsto \mathsf{sin.f64}\left(th\right) \]
        5. Simplified48.4%

          \[\leadsto \color{blue}{\sin th} \]
      4. Recombined 3 regimes into one program.
      5. Add Preprocessing

      Alternative 3: 99.7% accurate, 1.4× speedup?

      \[\begin{array}{l} \\ \sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \end{array} \]
      (FPCore (kx ky th)
       :precision binary64
       (* (sin th) (/ (sin ky) (hypot (sin ky) (sin kx)))))
      double code(double kx, double ky, double th) {
      	return sin(th) * (sin(ky) / hypot(sin(ky), sin(kx)));
      }
      
      public static double code(double kx, double ky, double th) {
      	return Math.sin(th) * (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx)));
      }
      
      def code(kx, ky, th):
      	return math.sin(th) * (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx)))
      
      function code(kx, ky, th)
      	return Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), sin(kx))))
      end
      
      function tmp = code(kx, ky, th)
      	tmp = sin(th) * (sin(ky) / hypot(sin(ky), sin(kx)));
      end
      
      code[kx_, ky_, th_] := N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
      
      \begin{array}{l}
      
      \\
      \sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}
      \end{array}
      
      Derivation
      1. Initial program 90.8%

        \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. +-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \left(\sqrt{{\sin ky}^{2} + {\sin kx}^{2}}\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
        2. unpow2N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \left(\sqrt{\sin ky \cdot \sin ky + {\sin kx}^{2}}\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
        3. unpow2N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \left(\sqrt{\sin ky \cdot \sin ky + \sin kx \cdot \sin kx}\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
        4. accelerator-lowering-hypot.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{hypot.f64}\left(\sin ky, \sin kx\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
        5. sin-lowering-sin.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(ky\right), \sin kx\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
        6. sin-lowering-sin.f6499.6%

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{sin.f64}\left(kx\right)\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
      4. Applied egg-rr99.6%

        \[\leadsto \frac{\sin ky}{\color{blue}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}} \cdot \sin th \]
      5. Final simplification99.6%

        \[\leadsto \sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \]
      6. Add Preprocessing

      Alternative 4: 63.8% accurate, 1.7× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;th \leq 75000000:\\ \;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right) \cdot \left(0.16666666666666666 \cdot \left(th \cdot th\right) + 1\right)}{th}}\\ \mathbf{elif}\;th \leq 4.9 \cdot 10^{+116}:\\ \;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(kx, \sin ky\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin kx, ky\right)}{\sin ky}}\\ \end{array} \end{array} \]
      (FPCore (kx ky th)
       :precision binary64
       (if (<= th 75000000.0)
         (/
          (sin ky)
          (/
           (* (hypot (sin kx) (sin ky)) (+ (* 0.16666666666666666 (* th th)) 1.0))
           th))
         (if (<= th 4.9e+116)
           (* (sin ky) (/ (sin th) (hypot kx (sin ky))))
           (/ (sin th) (/ (hypot (sin kx) ky) (sin ky))))))
      double code(double kx, double ky, double th) {
      	double tmp;
      	if (th <= 75000000.0) {
      		tmp = sin(ky) / ((hypot(sin(kx), sin(ky)) * ((0.16666666666666666 * (th * th)) + 1.0)) / th);
      	} else if (th <= 4.9e+116) {
      		tmp = sin(ky) * (sin(th) / hypot(kx, sin(ky)));
      	} else {
      		tmp = sin(th) / (hypot(sin(kx), ky) / sin(ky));
      	}
      	return tmp;
      }
      
      public static double code(double kx, double ky, double th) {
      	double tmp;
      	if (th <= 75000000.0) {
      		tmp = Math.sin(ky) / ((Math.hypot(Math.sin(kx), Math.sin(ky)) * ((0.16666666666666666 * (th * th)) + 1.0)) / th);
      	} else if (th <= 4.9e+116) {
      		tmp = Math.sin(ky) * (Math.sin(th) / Math.hypot(kx, Math.sin(ky)));
      	} else {
      		tmp = Math.sin(th) / (Math.hypot(Math.sin(kx), ky) / Math.sin(ky));
      	}
      	return tmp;
      }
      
      def code(kx, ky, th):
      	tmp = 0
      	if th <= 75000000.0:
      		tmp = math.sin(ky) / ((math.hypot(math.sin(kx), math.sin(ky)) * ((0.16666666666666666 * (th * th)) + 1.0)) / th)
      	elif th <= 4.9e+116:
      		tmp = math.sin(ky) * (math.sin(th) / math.hypot(kx, math.sin(ky)))
      	else:
      		tmp = math.sin(th) / (math.hypot(math.sin(kx), ky) / math.sin(ky))
      	return tmp
      
      function code(kx, ky, th)
      	tmp = 0.0
      	if (th <= 75000000.0)
      		tmp = Float64(sin(ky) / Float64(Float64(hypot(sin(kx), sin(ky)) * Float64(Float64(0.16666666666666666 * Float64(th * th)) + 1.0)) / th));
      	elseif (th <= 4.9e+116)
      		tmp = Float64(sin(ky) * Float64(sin(th) / hypot(kx, sin(ky))));
      	else
      		tmp = Float64(sin(th) / Float64(hypot(sin(kx), ky) / sin(ky)));
      	end
      	return tmp
      end
      
      function tmp_2 = code(kx, ky, th)
      	tmp = 0.0;
      	if (th <= 75000000.0)
      		tmp = sin(ky) / ((hypot(sin(kx), sin(ky)) * ((0.16666666666666666 * (th * th)) + 1.0)) / th);
      	elseif (th <= 4.9e+116)
      		tmp = sin(ky) * (sin(th) / hypot(kx, sin(ky)));
      	else
      		tmp = sin(th) / (hypot(sin(kx), ky) / sin(ky));
      	end
      	tmp_2 = tmp;
      end
      
      code[kx_, ky_, th_] := If[LessEqual[th, 75000000.0], N[(N[Sin[ky], $MachinePrecision] / N[(N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] * N[(N[(0.16666666666666666 * N[(th * th), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], If[LessEqual[th, 4.9e+116], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[kx ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + ky ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;th \leq 75000000:\\
      \;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right) \cdot \left(0.16666666666666666 \cdot \left(th \cdot th\right) + 1\right)}{th}}\\
      
      \mathbf{elif}\;th \leq 4.9 \cdot 10^{+116}:\\
      \;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(kx, \sin ky\right)}\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin kx, ky\right)}{\sin ky}}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if th < 7.5e7

        1. Initial program 92.5%

          \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
        2. Add Preprocessing
        3. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto \sin th \cdot \color{blue}{\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
          2. clear-numN/A

            \[\leadsto \sin th \cdot \frac{1}{\color{blue}{\frac{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}{\sin ky}}} \]
          3. un-div-invN/A

            \[\leadsto \frac{\sin th}{\color{blue}{\frac{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}{\sin ky}}} \]
          4. /-lowering-/.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\sin th, \color{blue}{\left(\frac{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}{\sin ky}\right)}\right) \]
          5. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \left(\frac{\color{blue}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}}{\sin ky}\right)\right) \]
          6. /-lowering-/.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right), \color{blue}{\sin ky}\right)\right) \]
          7. unpow2N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sqrt{\sin kx \cdot \sin kx + {\sin ky}^{2}}\right), \sin ky\right)\right) \]
          8. unpow2N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sqrt{\sin kx \cdot \sin kx + \sin ky \cdot \sin ky}\right), \sin ky\right)\right) \]
          9. accelerator-lowering-hypot.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\sin kx, \sin ky\right), \sin \color{blue}{ky}\right)\right) \]
          10. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \sin ky\right), \sin ky\right)\right) \]
          11. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right), \sin ky\right)\right) \]
          12. sin-lowering-sin.f6499.7%

            \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right), \mathsf{sin.f64}\left(ky\right)\right)\right) \]
        4. Applied egg-rr99.7%

          \[\leadsto \color{blue}{\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{\sin ky}}} \]
        5. Step-by-step derivation
          1. associate-/r/N/A

            \[\leadsto \frac{\sin th}{\sqrt{\sin kx \cdot \sin kx + \sin ky \cdot \sin ky}} \cdot \color{blue}{\sin ky} \]
          2. *-commutativeN/A

            \[\leadsto \sin ky \cdot \color{blue}{\frac{\sin th}{\sqrt{\sin kx \cdot \sin kx + \sin ky \cdot \sin ky}}} \]
          3. clear-numN/A

            \[\leadsto \sin ky \cdot \frac{1}{\color{blue}{\frac{\sqrt{\sin kx \cdot \sin kx + \sin ky \cdot \sin ky}}{\sin th}}} \]
          4. div-invN/A

            \[\leadsto \frac{\sin ky}{\color{blue}{\frac{\sqrt{\sin kx \cdot \sin kx + \sin ky \cdot \sin ky}}{\sin th}}} \]
          5. /-lowering-/.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\sin ky, \color{blue}{\left(\frac{\sqrt{\sin kx \cdot \sin kx + \sin ky \cdot \sin ky}}{\sin th}\right)}\right) \]
          6. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \left(\frac{\color{blue}{\sqrt{\sin kx \cdot \sin kx + \sin ky \cdot \sin ky}}}{\sin th}\right)\right) \]
          7. /-lowering-/.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{/.f64}\left(\left(\sqrt{\sin kx \cdot \sin kx + \sin ky \cdot \sin ky}\right), \color{blue}{\sin th}\right)\right) \]
          8. accelerator-lowering-hypot.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\sin kx, \sin ky\right), \sin \color{blue}{th}\right)\right) \]
          9. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \sin ky\right), \sin th\right)\right) \]
          10. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right), \sin th\right)\right) \]
          11. sin-lowering-sin.f6499.6%

            \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right), \mathsf{sin.f64}\left(th\right)\right)\right) \]
        6. Applied egg-rr99.6%

          \[\leadsto \color{blue}{\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{\sin th}}} \]
        7. Taylor expanded in th around 0

          \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \color{blue}{\left(\frac{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}} + \frac{1}{6} \cdot \left({th}^{2} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)}{th}\right)}\right) \]
        8. Step-by-step derivation
          1. /-lowering-/.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{/.f64}\left(\left(\sqrt{{\sin kx}^{2} + {\sin ky}^{2}} + \frac{1}{6} \cdot \left({th}^{2} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)\right), \color{blue}{th}\right)\right) \]
        9. Simplified68.9%

          \[\leadsto \frac{\sin ky}{\color{blue}{\frac{\left(0.16666666666666666 \cdot \left(th \cdot th\right) + 1\right) \cdot \mathsf{hypot}\left(\sin kx, \sin ky\right)}{th}}} \]

        if 7.5e7 < th < 4.8999999999999998e116

        1. Initial program 90.7%

          \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
        2. Add Preprocessing
        3. Step-by-step derivation
          1. associate-*l/N/A

            \[\leadsto \frac{\sin ky \cdot \sin th}{\color{blue}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
          2. associate-/l*N/A

            \[\leadsto \sin ky \cdot \color{blue}{\frac{\sin th}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
          3. *-commutativeN/A

            \[\leadsto \frac{\sin th}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \color{blue}{\sin ky} \]
          4. *-lowering-*.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\left(\frac{\sin th}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\right), \color{blue}{\sin ky}\right) \]
          5. /-lowering-/.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\sin th, \left(\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)\right), \sin \color{blue}{ky}\right) \]
          6. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \left(\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)\right), \sin ky\right) \]
          7. unpow2N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \left(\sqrt{\sin kx \cdot \sin kx + {\sin ky}^{2}}\right)\right), \sin ky\right) \]
          8. unpow2N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \left(\sqrt{\sin kx \cdot \sin kx + \sin ky \cdot \sin ky}\right)\right), \sin ky\right) \]
          9. accelerator-lowering-hypot.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{hypot.f64}\left(\sin kx, \sin ky\right)\right), \sin ky\right) \]
          10. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \sin ky\right)\right), \sin ky\right) \]
          11. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right)\right), \sin ky\right) \]
          12. sin-lowering-sin.f6499.4%

            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right)\right), \mathsf{sin.f64}\left(ky\right)\right) \]
        4. Applied egg-rr99.4%

          \[\leadsto \color{blue}{\frac{\sin th}{\mathsf{hypot}\left(\sin kx, \sin ky\right)} \cdot \sin ky} \]
        5. Taylor expanded in kx around 0

          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{hypot.f64}\left(\color{blue}{kx}, \mathsf{sin.f64}\left(ky\right)\right)\right), \mathsf{sin.f64}\left(ky\right)\right) \]
        6. Step-by-step derivation
          1. Simplified61.3%

            \[\leadsto \frac{\sin th}{\mathsf{hypot}\left(\color{blue}{kx}, \sin ky\right)} \cdot \sin ky \]

          if 4.8999999999999998e116 < th

          1. Initial program 82.6%

            \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
          2. Add Preprocessing
          3. Step-by-step derivation
            1. *-commutativeN/A

              \[\leadsto \sin th \cdot \color{blue}{\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
            2. clear-numN/A

              \[\leadsto \sin th \cdot \frac{1}{\color{blue}{\frac{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}{\sin ky}}} \]
            3. un-div-invN/A

              \[\leadsto \frac{\sin th}{\color{blue}{\frac{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}{\sin ky}}} \]
            4. /-lowering-/.f64N/A

              \[\leadsto \mathsf{/.f64}\left(\sin th, \color{blue}{\left(\frac{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}{\sin ky}\right)}\right) \]
            5. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \left(\frac{\color{blue}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}}{\sin ky}\right)\right) \]
            6. /-lowering-/.f64N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right), \color{blue}{\sin ky}\right)\right) \]
            7. unpow2N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sqrt{\sin kx \cdot \sin kx + {\sin ky}^{2}}\right), \sin ky\right)\right) \]
            8. unpow2N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sqrt{\sin kx \cdot \sin kx + \sin ky \cdot \sin ky}\right), \sin ky\right)\right) \]
            9. accelerator-lowering-hypot.f64N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\sin kx, \sin ky\right), \sin \color{blue}{ky}\right)\right) \]
            10. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \sin ky\right), \sin ky\right)\right) \]
            11. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right), \sin ky\right)\right) \]
            12. sin-lowering-sin.f6499.6%

              \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right), \mathsf{sin.f64}\left(ky\right)\right)\right) \]
          4. Applied egg-rr99.6%

            \[\leadsto \color{blue}{\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{\sin ky}}} \]
          5. Taylor expanded in ky around 0

            \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \color{blue}{ky}\right), \mathsf{sin.f64}\left(ky\right)\right)\right) \]
          6. Step-by-step derivation
            1. Simplified59.0%

              \[\leadsto \frac{\sin th}{\frac{\mathsf{hypot}\left(\sin kx, \color{blue}{ky}\right)}{\sin ky}} \]
          7. Recombined 3 regimes into one program.
          8. Final simplification66.7%

            \[\leadsto \begin{array}{l} \mathbf{if}\;th \leq 75000000:\\ \;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right) \cdot \left(0.16666666666666666 \cdot \left(th \cdot th\right) + 1\right)}{th}}\\ \mathbf{elif}\;th \leq 4.9 \cdot 10^{+116}:\\ \;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(kx, \sin ky\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin kx, ky\right)}{\sin ky}}\\ \end{array} \]
          9. Add Preprocessing

          Alternative 5: 63.6% accurate, 1.7× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;th \leq 11:\\ \;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \left(th \cdot \left(1 + th \cdot \left(th \cdot -0.16666666666666666\right)\right)\right)\\ \mathbf{elif}\;th \leq 6.1 \cdot 10^{+116}:\\ \;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(kx, \sin ky\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin kx, ky\right)}{\sin ky}}\\ \end{array} \end{array} \]
          (FPCore (kx ky th)
           :precision binary64
           (if (<= th 11.0)
             (*
              (/ (sin ky) (hypot (sin ky) (sin kx)))
              (* th (+ 1.0 (* th (* th -0.16666666666666666)))))
             (if (<= th 6.1e+116)
               (* (sin ky) (/ (sin th) (hypot kx (sin ky))))
               (/ (sin th) (/ (hypot (sin kx) ky) (sin ky))))))
          double code(double kx, double ky, double th) {
          	double tmp;
          	if (th <= 11.0) {
          		tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * (th * (1.0 + (th * (th * -0.16666666666666666))));
          	} else if (th <= 6.1e+116) {
          		tmp = sin(ky) * (sin(th) / hypot(kx, sin(ky)));
          	} else {
          		tmp = sin(th) / (hypot(sin(kx), ky) / sin(ky));
          	}
          	return tmp;
          }
          
          public static double code(double kx, double ky, double th) {
          	double tmp;
          	if (th <= 11.0) {
          		tmp = (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * (th * (1.0 + (th * (th * -0.16666666666666666))));
          	} else if (th <= 6.1e+116) {
          		tmp = Math.sin(ky) * (Math.sin(th) / Math.hypot(kx, Math.sin(ky)));
          	} else {
          		tmp = Math.sin(th) / (Math.hypot(Math.sin(kx), ky) / Math.sin(ky));
          	}
          	return tmp;
          }
          
          def code(kx, ky, th):
          	tmp = 0
          	if th <= 11.0:
          		tmp = (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * (th * (1.0 + (th * (th * -0.16666666666666666))))
          	elif th <= 6.1e+116:
          		tmp = math.sin(ky) * (math.sin(th) / math.hypot(kx, math.sin(ky)))
          	else:
          		tmp = math.sin(th) / (math.hypot(math.sin(kx), ky) / math.sin(ky))
          	return tmp
          
          function code(kx, ky, th)
          	tmp = 0.0
          	if (th <= 11.0)
          		tmp = Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * Float64(th * Float64(1.0 + Float64(th * Float64(th * -0.16666666666666666)))));
          	elseif (th <= 6.1e+116)
          		tmp = Float64(sin(ky) * Float64(sin(th) / hypot(kx, sin(ky))));
          	else
          		tmp = Float64(sin(th) / Float64(hypot(sin(kx), ky) / sin(ky)));
          	end
          	return tmp
          end
          
          function tmp_2 = code(kx, ky, th)
          	tmp = 0.0;
          	if (th <= 11.0)
          		tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * (th * (1.0 + (th * (th * -0.16666666666666666))));
          	elseif (th <= 6.1e+116)
          		tmp = sin(ky) * (sin(th) / hypot(kx, sin(ky)));
          	else
          		tmp = sin(th) / (hypot(sin(kx), ky) / sin(ky));
          	end
          	tmp_2 = tmp;
          end
          
          code[kx_, ky_, th_] := If[LessEqual[th, 11.0], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[(th * N[(1.0 + N[(th * N[(th * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[th, 6.1e+116], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[kx ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + ky ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;th \leq 11:\\
          \;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \left(th \cdot \left(1 + th \cdot \left(th \cdot -0.16666666666666666\right)\right)\right)\\
          
          \mathbf{elif}\;th \leq 6.1 \cdot 10^{+116}:\\
          \;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(kx, \sin ky\right)}\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin kx, ky\right)}{\sin ky}}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 3 regimes
          2. if th < 11

            1. Initial program 92.4%

              \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
            2. Add Preprocessing
            3. Step-by-step derivation
              1. +-commutativeN/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \left(\sqrt{{\sin ky}^{2} + {\sin kx}^{2}}\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
              2. unpow2N/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \left(\sqrt{\sin ky \cdot \sin ky + {\sin kx}^{2}}\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
              3. unpow2N/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \left(\sqrt{\sin ky \cdot \sin ky + \sin kx \cdot \sin kx}\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
              4. accelerator-lowering-hypot.f64N/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{hypot.f64}\left(\sin ky, \sin kx\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
              5. sin-lowering-sin.f64N/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(ky\right), \sin kx\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
              6. sin-lowering-sin.f6499.7%

                \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{sin.f64}\left(kx\right)\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
            4. Applied egg-rr99.7%

              \[\leadsto \frac{\sin ky}{\color{blue}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}} \cdot \sin th \]
            5. Taylor expanded in th around 0

              \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{sin.f64}\left(kx\right)\right)\right), \color{blue}{\left(th \cdot \left(1 + \frac{-1}{6} \cdot {th}^{2}\right)\right)}\right) \]
            6. Step-by-step derivation
              1. *-lowering-*.f64N/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{sin.f64}\left(kx\right)\right)\right), \mathsf{*.f64}\left(th, \color{blue}{\left(1 + \frac{-1}{6} \cdot {th}^{2}\right)}\right)\right) \]
              2. +-lowering-+.f64N/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{sin.f64}\left(kx\right)\right)\right), \mathsf{*.f64}\left(th, \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{-1}{6} \cdot {th}^{2}\right)}\right)\right)\right) \]
              3. *-commutativeN/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{sin.f64}\left(kx\right)\right)\right), \mathsf{*.f64}\left(th, \mathsf{+.f64}\left(1, \left({th}^{2} \cdot \color{blue}{\frac{-1}{6}}\right)\right)\right)\right) \]
              4. unpow2N/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{sin.f64}\left(kx\right)\right)\right), \mathsf{*.f64}\left(th, \mathsf{+.f64}\left(1, \left(\left(th \cdot th\right) \cdot \frac{-1}{6}\right)\right)\right)\right) \]
              5. associate-*l*N/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{sin.f64}\left(kx\right)\right)\right), \mathsf{*.f64}\left(th, \mathsf{+.f64}\left(1, \left(th \cdot \color{blue}{\left(th \cdot \frac{-1}{6}\right)}\right)\right)\right)\right) \]
              6. *-lowering-*.f64N/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{sin.f64}\left(kx\right)\right)\right), \mathsf{*.f64}\left(th, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(th, \color{blue}{\left(th \cdot \frac{-1}{6}\right)}\right)\right)\right)\right) \]
              7. *-lowering-*.f6468.4%

                \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{sin.f64}\left(kx\right)\right)\right), \mathsf{*.f64}\left(th, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(th, \mathsf{*.f64}\left(th, \color{blue}{\frac{-1}{6}}\right)\right)\right)\right)\right) \]
            7. Simplified68.4%

              \[\leadsto \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \color{blue}{\left(th \cdot \left(1 + th \cdot \left(th \cdot -0.16666666666666666\right)\right)\right)} \]

            if 11 < th < 6.10000000000000018e116

            1. Initial program 91.1%

              \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
            2. Add Preprocessing
            3. Step-by-step derivation
              1. associate-*l/N/A

                \[\leadsto \frac{\sin ky \cdot \sin th}{\color{blue}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
              2. associate-/l*N/A

                \[\leadsto \sin ky \cdot \color{blue}{\frac{\sin th}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
              3. *-commutativeN/A

                \[\leadsto \frac{\sin th}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \color{blue}{\sin ky} \]
              4. *-lowering-*.f64N/A

                \[\leadsto \mathsf{*.f64}\left(\left(\frac{\sin th}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\right), \color{blue}{\sin ky}\right) \]
              5. /-lowering-/.f64N/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\sin th, \left(\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)\right), \sin \color{blue}{ky}\right) \]
              6. sin-lowering-sin.f64N/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \left(\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)\right), \sin ky\right) \]
              7. unpow2N/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \left(\sqrt{\sin kx \cdot \sin kx + {\sin ky}^{2}}\right)\right), \sin ky\right) \]
              8. unpow2N/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \left(\sqrt{\sin kx \cdot \sin kx + \sin ky \cdot \sin ky}\right)\right), \sin ky\right) \]
              9. accelerator-lowering-hypot.f64N/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{hypot.f64}\left(\sin kx, \sin ky\right)\right), \sin ky\right) \]
              10. sin-lowering-sin.f64N/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \sin ky\right)\right), \sin ky\right) \]
              11. sin-lowering-sin.f64N/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right)\right), \sin ky\right) \]
              12. sin-lowering-sin.f6499.4%

                \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right)\right), \mathsf{sin.f64}\left(ky\right)\right) \]
            4. Applied egg-rr99.4%

              \[\leadsto \color{blue}{\frac{\sin th}{\mathsf{hypot}\left(\sin kx, \sin ky\right)} \cdot \sin ky} \]
            5. Taylor expanded in kx around 0

              \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{hypot.f64}\left(\color{blue}{kx}, \mathsf{sin.f64}\left(ky\right)\right)\right), \mathsf{sin.f64}\left(ky\right)\right) \]
            6. Step-by-step derivation
              1. Simplified59.0%

                \[\leadsto \frac{\sin th}{\mathsf{hypot}\left(\color{blue}{kx}, \sin ky\right)} \cdot \sin ky \]

              if 6.10000000000000018e116 < th

              1. Initial program 82.6%

                \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
              2. Add Preprocessing
              3. Step-by-step derivation
                1. *-commutativeN/A

                  \[\leadsto \sin th \cdot \color{blue}{\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
                2. clear-numN/A

                  \[\leadsto \sin th \cdot \frac{1}{\color{blue}{\frac{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}{\sin ky}}} \]
                3. un-div-invN/A

                  \[\leadsto \frac{\sin th}{\color{blue}{\frac{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}{\sin ky}}} \]
                4. /-lowering-/.f64N/A

                  \[\leadsto \mathsf{/.f64}\left(\sin th, \color{blue}{\left(\frac{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}{\sin ky}\right)}\right) \]
                5. sin-lowering-sin.f64N/A

                  \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \left(\frac{\color{blue}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}}{\sin ky}\right)\right) \]
                6. /-lowering-/.f64N/A

                  \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right), \color{blue}{\sin ky}\right)\right) \]
                7. unpow2N/A

                  \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sqrt{\sin kx \cdot \sin kx + {\sin ky}^{2}}\right), \sin ky\right)\right) \]
                8. unpow2N/A

                  \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sqrt{\sin kx \cdot \sin kx + \sin ky \cdot \sin ky}\right), \sin ky\right)\right) \]
                9. accelerator-lowering-hypot.f64N/A

                  \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\sin kx, \sin ky\right), \sin \color{blue}{ky}\right)\right) \]
                10. sin-lowering-sin.f64N/A

                  \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \sin ky\right), \sin ky\right)\right) \]
                11. sin-lowering-sin.f64N/A

                  \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right), \sin ky\right)\right) \]
                12. sin-lowering-sin.f6499.6%

                  \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right), \mathsf{sin.f64}\left(ky\right)\right)\right) \]
              4. Applied egg-rr99.6%

                \[\leadsto \color{blue}{\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{\sin ky}}} \]
              5. Taylor expanded in ky around 0

                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \color{blue}{ky}\right), \mathsf{sin.f64}\left(ky\right)\right)\right) \]
              6. Step-by-step derivation
                1. Simplified59.0%

                  \[\leadsto \frac{\sin th}{\frac{\mathsf{hypot}\left(\sin kx, \color{blue}{ky}\right)}{\sin ky}} \]
              7. Recombined 3 regimes into one program.
              8. Final simplification66.1%

                \[\leadsto \begin{array}{l} \mathbf{if}\;th \leq 11:\\ \;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \left(th \cdot \left(1 + th \cdot \left(th \cdot -0.16666666666666666\right)\right)\right)\\ \mathbf{elif}\;th \leq 6.1 \cdot 10^{+116}:\\ \;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(kx, \sin ky\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin kx, ky\right)}{\sin ky}}\\ \end{array} \]
              9. Add Preprocessing

              Alternative 6: 63.4% accurate, 1.7× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;th \leq 75000000:\\ \;\;\;\;th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\ \mathbf{elif}\;th \leq 6.2 \cdot 10^{+116}:\\ \;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(kx, \sin ky\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin kx, ky\right)}{\sin ky}}\\ \end{array} \end{array} \]
              (FPCore (kx ky th)
               :precision binary64
               (if (<= th 75000000.0)
                 (* th (/ (sin ky) (hypot (sin ky) (sin kx))))
                 (if (<= th 6.2e+116)
                   (* (sin ky) (/ (sin th) (hypot kx (sin ky))))
                   (/ (sin th) (/ (hypot (sin kx) ky) (sin ky))))))
              double code(double kx, double ky, double th) {
              	double tmp;
              	if (th <= 75000000.0) {
              		tmp = th * (sin(ky) / hypot(sin(ky), sin(kx)));
              	} else if (th <= 6.2e+116) {
              		tmp = sin(ky) * (sin(th) / hypot(kx, sin(ky)));
              	} else {
              		tmp = sin(th) / (hypot(sin(kx), ky) / sin(ky));
              	}
              	return tmp;
              }
              
              public static double code(double kx, double ky, double th) {
              	double tmp;
              	if (th <= 75000000.0) {
              		tmp = th * (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx)));
              	} else if (th <= 6.2e+116) {
              		tmp = Math.sin(ky) * (Math.sin(th) / Math.hypot(kx, Math.sin(ky)));
              	} else {
              		tmp = Math.sin(th) / (Math.hypot(Math.sin(kx), ky) / Math.sin(ky));
              	}
              	return tmp;
              }
              
              def code(kx, ky, th):
              	tmp = 0
              	if th <= 75000000.0:
              		tmp = th * (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx)))
              	elif th <= 6.2e+116:
              		tmp = math.sin(ky) * (math.sin(th) / math.hypot(kx, math.sin(ky)))
              	else:
              		tmp = math.sin(th) / (math.hypot(math.sin(kx), ky) / math.sin(ky))
              	return tmp
              
              function code(kx, ky, th)
              	tmp = 0.0
              	if (th <= 75000000.0)
              		tmp = Float64(th * Float64(sin(ky) / hypot(sin(ky), sin(kx))));
              	elseif (th <= 6.2e+116)
              		tmp = Float64(sin(ky) * Float64(sin(th) / hypot(kx, sin(ky))));
              	else
              		tmp = Float64(sin(th) / Float64(hypot(sin(kx), ky) / sin(ky)));
              	end
              	return tmp
              end
              
              function tmp_2 = code(kx, ky, th)
              	tmp = 0.0;
              	if (th <= 75000000.0)
              		tmp = th * (sin(ky) / hypot(sin(ky), sin(kx)));
              	elseif (th <= 6.2e+116)
              		tmp = sin(ky) * (sin(th) / hypot(kx, sin(ky)));
              	else
              		tmp = sin(th) / (hypot(sin(kx), ky) / sin(ky));
              	end
              	tmp_2 = tmp;
              end
              
              code[kx_, ky_, th_] := If[LessEqual[th, 75000000.0], N[(th * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[th, 6.2e+116], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[kx ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + ky ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              \mathbf{if}\;th \leq 75000000:\\
              \;\;\;\;th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
              
              \mathbf{elif}\;th \leq 6.2 \cdot 10^{+116}:\\
              \;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(kx, \sin ky\right)}\\
              
              \mathbf{else}:\\
              \;\;\;\;\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin kx, ky\right)}{\sin ky}}\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 3 regimes
              2. if th < 7.5e7

                1. Initial program 92.5%

                  \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
                2. Add Preprocessing
                3. Step-by-step derivation
                  1. +-commutativeN/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \left(\sqrt{{\sin ky}^{2} + {\sin kx}^{2}}\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                  2. unpow2N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \left(\sqrt{\sin ky \cdot \sin ky + {\sin kx}^{2}}\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                  3. unpow2N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \left(\sqrt{\sin ky \cdot \sin ky + \sin kx \cdot \sin kx}\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                  4. accelerator-lowering-hypot.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{hypot.f64}\left(\sin ky, \sin kx\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                  5. sin-lowering-sin.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(ky\right), \sin kx\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                  6. sin-lowering-sin.f6499.6%

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{sin.f64}\left(kx\right)\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                4. Applied egg-rr99.6%

                  \[\leadsto \frac{\sin ky}{\color{blue}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}} \cdot \sin th \]
                5. Taylor expanded in th around 0

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{sin.f64}\left(kx\right)\right)\right), \color{blue}{th}\right) \]
                6. Step-by-step derivation
                  1. Simplified68.5%

                    \[\leadsto \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \color{blue}{th} \]

                  if 7.5e7 < th < 6.19999999999999992e116

                  1. Initial program 90.7%

                    \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
                  2. Add Preprocessing
                  3. Step-by-step derivation
                    1. associate-*l/N/A

                      \[\leadsto \frac{\sin ky \cdot \sin th}{\color{blue}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
                    2. associate-/l*N/A

                      \[\leadsto \sin ky \cdot \color{blue}{\frac{\sin th}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
                    3. *-commutativeN/A

                      \[\leadsto \frac{\sin th}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \color{blue}{\sin ky} \]
                    4. *-lowering-*.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(\left(\frac{\sin th}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\right), \color{blue}{\sin ky}\right) \]
                    5. /-lowering-/.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\sin th, \left(\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)\right), \sin \color{blue}{ky}\right) \]
                    6. sin-lowering-sin.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \left(\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)\right), \sin ky\right) \]
                    7. unpow2N/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \left(\sqrt{\sin kx \cdot \sin kx + {\sin ky}^{2}}\right)\right), \sin ky\right) \]
                    8. unpow2N/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \left(\sqrt{\sin kx \cdot \sin kx + \sin ky \cdot \sin ky}\right)\right), \sin ky\right) \]
                    9. accelerator-lowering-hypot.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{hypot.f64}\left(\sin kx, \sin ky\right)\right), \sin ky\right) \]
                    10. sin-lowering-sin.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \sin ky\right)\right), \sin ky\right) \]
                    11. sin-lowering-sin.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right)\right), \sin ky\right) \]
                    12. sin-lowering-sin.f6499.4%

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right)\right), \mathsf{sin.f64}\left(ky\right)\right) \]
                  4. Applied egg-rr99.4%

                    \[\leadsto \color{blue}{\frac{\sin th}{\mathsf{hypot}\left(\sin kx, \sin ky\right)} \cdot \sin ky} \]
                  5. Taylor expanded in kx around 0

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{hypot.f64}\left(\color{blue}{kx}, \mathsf{sin.f64}\left(ky\right)\right)\right), \mathsf{sin.f64}\left(ky\right)\right) \]
                  6. Step-by-step derivation
                    1. Simplified61.3%

                      \[\leadsto \frac{\sin th}{\mathsf{hypot}\left(\color{blue}{kx}, \sin ky\right)} \cdot \sin ky \]

                    if 6.19999999999999992e116 < th

                    1. Initial program 82.6%

                      \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
                    2. Add Preprocessing
                    3. Step-by-step derivation
                      1. *-commutativeN/A

                        \[\leadsto \sin th \cdot \color{blue}{\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
                      2. clear-numN/A

                        \[\leadsto \sin th \cdot \frac{1}{\color{blue}{\frac{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}{\sin ky}}} \]
                      3. un-div-invN/A

                        \[\leadsto \frac{\sin th}{\color{blue}{\frac{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}{\sin ky}}} \]
                      4. /-lowering-/.f64N/A

                        \[\leadsto \mathsf{/.f64}\left(\sin th, \color{blue}{\left(\frac{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}{\sin ky}\right)}\right) \]
                      5. sin-lowering-sin.f64N/A

                        \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \left(\frac{\color{blue}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}}{\sin ky}\right)\right) \]
                      6. /-lowering-/.f64N/A

                        \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right), \color{blue}{\sin ky}\right)\right) \]
                      7. unpow2N/A

                        \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sqrt{\sin kx \cdot \sin kx + {\sin ky}^{2}}\right), \sin ky\right)\right) \]
                      8. unpow2N/A

                        \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sqrt{\sin kx \cdot \sin kx + \sin ky \cdot \sin ky}\right), \sin ky\right)\right) \]
                      9. accelerator-lowering-hypot.f64N/A

                        \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\sin kx, \sin ky\right), \sin \color{blue}{ky}\right)\right) \]
                      10. sin-lowering-sin.f64N/A

                        \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \sin ky\right), \sin ky\right)\right) \]
                      11. sin-lowering-sin.f64N/A

                        \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right), \sin ky\right)\right) \]
                      12. sin-lowering-sin.f6499.6%

                        \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right), \mathsf{sin.f64}\left(ky\right)\right)\right) \]
                    4. Applied egg-rr99.6%

                      \[\leadsto \color{blue}{\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{\sin ky}}} \]
                    5. Taylor expanded in ky around 0

                      \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \color{blue}{ky}\right), \mathsf{sin.f64}\left(ky\right)\right)\right) \]
                    6. Step-by-step derivation
                      1. Simplified59.0%

                        \[\leadsto \frac{\sin th}{\frac{\mathsf{hypot}\left(\sin kx, \color{blue}{ky}\right)}{\sin ky}} \]
                    7. Recombined 3 regimes into one program.
                    8. Final simplification66.4%

                      \[\leadsto \begin{array}{l} \mathbf{if}\;th \leq 75000000:\\ \;\;\;\;th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\ \mathbf{elif}\;th \leq 6.2 \cdot 10^{+116}:\\ \;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(kx, \sin ky\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin kx, ky\right)}{\sin ky}}\\ \end{array} \]
                    9. Add Preprocessing

                    Alternative 7: 63.4% accurate, 1.7× speedup?

                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;th \leq 75000000:\\ \;\;\;\;th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\ \mathbf{elif}\;th \leq 5.5 \cdot 10^{+116}:\\ \;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(kx, \sin ky\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin kx, ky\right)}{\sin th}}\\ \end{array} \end{array} \]
                    (FPCore (kx ky th)
                     :precision binary64
                     (if (<= th 75000000.0)
                       (* th (/ (sin ky) (hypot (sin ky) (sin kx))))
                       (if (<= th 5.5e+116)
                         (* (sin ky) (/ (sin th) (hypot kx (sin ky))))
                         (/ (sin ky) (/ (hypot (sin kx) ky) (sin th))))))
                    double code(double kx, double ky, double th) {
                    	double tmp;
                    	if (th <= 75000000.0) {
                    		tmp = th * (sin(ky) / hypot(sin(ky), sin(kx)));
                    	} else if (th <= 5.5e+116) {
                    		tmp = sin(ky) * (sin(th) / hypot(kx, sin(ky)));
                    	} else {
                    		tmp = sin(ky) / (hypot(sin(kx), ky) / sin(th));
                    	}
                    	return tmp;
                    }
                    
                    public static double code(double kx, double ky, double th) {
                    	double tmp;
                    	if (th <= 75000000.0) {
                    		tmp = th * (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx)));
                    	} else if (th <= 5.5e+116) {
                    		tmp = Math.sin(ky) * (Math.sin(th) / Math.hypot(kx, Math.sin(ky)));
                    	} else {
                    		tmp = Math.sin(ky) / (Math.hypot(Math.sin(kx), ky) / Math.sin(th));
                    	}
                    	return tmp;
                    }
                    
                    def code(kx, ky, th):
                    	tmp = 0
                    	if th <= 75000000.0:
                    		tmp = th * (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx)))
                    	elif th <= 5.5e+116:
                    		tmp = math.sin(ky) * (math.sin(th) / math.hypot(kx, math.sin(ky)))
                    	else:
                    		tmp = math.sin(ky) / (math.hypot(math.sin(kx), ky) / math.sin(th))
                    	return tmp
                    
                    function code(kx, ky, th)
                    	tmp = 0.0
                    	if (th <= 75000000.0)
                    		tmp = Float64(th * Float64(sin(ky) / hypot(sin(ky), sin(kx))));
                    	elseif (th <= 5.5e+116)
                    		tmp = Float64(sin(ky) * Float64(sin(th) / hypot(kx, sin(ky))));
                    	else
                    		tmp = Float64(sin(ky) / Float64(hypot(sin(kx), ky) / sin(th)));
                    	end
                    	return tmp
                    end
                    
                    function tmp_2 = code(kx, ky, th)
                    	tmp = 0.0;
                    	if (th <= 75000000.0)
                    		tmp = th * (sin(ky) / hypot(sin(ky), sin(kx)));
                    	elseif (th <= 5.5e+116)
                    		tmp = sin(ky) * (sin(th) / hypot(kx, sin(ky)));
                    	else
                    		tmp = sin(ky) / (hypot(sin(kx), ky) / sin(th));
                    	end
                    	tmp_2 = tmp;
                    end
                    
                    code[kx_, ky_, th_] := If[LessEqual[th, 75000000.0], N[(th * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[th, 5.5e+116], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[kx ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + ky ^ 2], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
                    
                    \begin{array}{l}
                    
                    \\
                    \begin{array}{l}
                    \mathbf{if}\;th \leq 75000000:\\
                    \;\;\;\;th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
                    
                    \mathbf{elif}\;th \leq 5.5 \cdot 10^{+116}:\\
                    \;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(kx, \sin ky\right)}\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin kx, ky\right)}{\sin th}}\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 3 regimes
                    2. if th < 7.5e7

                      1. Initial program 92.5%

                        \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
                      2. Add Preprocessing
                      3. Step-by-step derivation
                        1. +-commutativeN/A

                          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \left(\sqrt{{\sin ky}^{2} + {\sin kx}^{2}}\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                        2. unpow2N/A

                          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \left(\sqrt{\sin ky \cdot \sin ky + {\sin kx}^{2}}\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                        3. unpow2N/A

                          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \left(\sqrt{\sin ky \cdot \sin ky + \sin kx \cdot \sin kx}\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                        4. accelerator-lowering-hypot.f64N/A

                          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{hypot.f64}\left(\sin ky, \sin kx\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                        5. sin-lowering-sin.f64N/A

                          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(ky\right), \sin kx\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                        6. sin-lowering-sin.f6499.6%

                          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{sin.f64}\left(kx\right)\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                      4. Applied egg-rr99.6%

                        \[\leadsto \frac{\sin ky}{\color{blue}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}} \cdot \sin th \]
                      5. Taylor expanded in th around 0

                        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{sin.f64}\left(kx\right)\right)\right), \color{blue}{th}\right) \]
                      6. Step-by-step derivation
                        1. Simplified68.5%

                          \[\leadsto \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \color{blue}{th} \]

                        if 7.5e7 < th < 5.50000000000000035e116

                        1. Initial program 90.7%

                          \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
                        2. Add Preprocessing
                        3. Step-by-step derivation
                          1. associate-*l/N/A

                            \[\leadsto \frac{\sin ky \cdot \sin th}{\color{blue}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
                          2. associate-/l*N/A

                            \[\leadsto \sin ky \cdot \color{blue}{\frac{\sin th}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
                          3. *-commutativeN/A

                            \[\leadsto \frac{\sin th}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \color{blue}{\sin ky} \]
                          4. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\left(\frac{\sin th}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\right), \color{blue}{\sin ky}\right) \]
                          5. /-lowering-/.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\sin th, \left(\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)\right), \sin \color{blue}{ky}\right) \]
                          6. sin-lowering-sin.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \left(\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)\right), \sin ky\right) \]
                          7. unpow2N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \left(\sqrt{\sin kx \cdot \sin kx + {\sin ky}^{2}}\right)\right), \sin ky\right) \]
                          8. unpow2N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \left(\sqrt{\sin kx \cdot \sin kx + \sin ky \cdot \sin ky}\right)\right), \sin ky\right) \]
                          9. accelerator-lowering-hypot.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{hypot.f64}\left(\sin kx, \sin ky\right)\right), \sin ky\right) \]
                          10. sin-lowering-sin.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \sin ky\right)\right), \sin ky\right) \]
                          11. sin-lowering-sin.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right)\right), \sin ky\right) \]
                          12. sin-lowering-sin.f6499.4%

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right)\right), \mathsf{sin.f64}\left(ky\right)\right) \]
                        4. Applied egg-rr99.4%

                          \[\leadsto \color{blue}{\frac{\sin th}{\mathsf{hypot}\left(\sin kx, \sin ky\right)} \cdot \sin ky} \]
                        5. Taylor expanded in kx around 0

                          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{hypot.f64}\left(\color{blue}{kx}, \mathsf{sin.f64}\left(ky\right)\right)\right), \mathsf{sin.f64}\left(ky\right)\right) \]
                        6. Step-by-step derivation
                          1. Simplified61.3%

                            \[\leadsto \frac{\sin th}{\mathsf{hypot}\left(\color{blue}{kx}, \sin ky\right)} \cdot \sin ky \]

                          if 5.50000000000000035e116 < th

                          1. Initial program 82.6%

                            \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
                          2. Add Preprocessing
                          3. Step-by-step derivation
                            1. *-commutativeN/A

                              \[\leadsto \sin th \cdot \color{blue}{\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
                            2. clear-numN/A

                              \[\leadsto \sin th \cdot \frac{1}{\color{blue}{\frac{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}{\sin ky}}} \]
                            3. un-div-invN/A

                              \[\leadsto \frac{\sin th}{\color{blue}{\frac{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}{\sin ky}}} \]
                            4. /-lowering-/.f64N/A

                              \[\leadsto \mathsf{/.f64}\left(\sin th, \color{blue}{\left(\frac{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}{\sin ky}\right)}\right) \]
                            5. sin-lowering-sin.f64N/A

                              \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \left(\frac{\color{blue}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}}{\sin ky}\right)\right) \]
                            6. /-lowering-/.f64N/A

                              \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right), \color{blue}{\sin ky}\right)\right) \]
                            7. unpow2N/A

                              \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sqrt{\sin kx \cdot \sin kx + {\sin ky}^{2}}\right), \sin ky\right)\right) \]
                            8. unpow2N/A

                              \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sqrt{\sin kx \cdot \sin kx + \sin ky \cdot \sin ky}\right), \sin ky\right)\right) \]
                            9. accelerator-lowering-hypot.f64N/A

                              \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\sin kx, \sin ky\right), \sin \color{blue}{ky}\right)\right) \]
                            10. sin-lowering-sin.f64N/A

                              \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \sin ky\right), \sin ky\right)\right) \]
                            11. sin-lowering-sin.f64N/A

                              \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right), \sin ky\right)\right) \]
                            12. sin-lowering-sin.f6499.6%

                              \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right), \mathsf{sin.f64}\left(ky\right)\right)\right) \]
                          4. Applied egg-rr99.6%

                            \[\leadsto \color{blue}{\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{\sin ky}}} \]
                          5. Step-by-step derivation
                            1. associate-/r/N/A

                              \[\leadsto \frac{\sin th}{\sqrt{\sin kx \cdot \sin kx + \sin ky \cdot \sin ky}} \cdot \color{blue}{\sin ky} \]
                            2. *-commutativeN/A

                              \[\leadsto \sin ky \cdot \color{blue}{\frac{\sin th}{\sqrt{\sin kx \cdot \sin kx + \sin ky \cdot \sin ky}}} \]
                            3. clear-numN/A

                              \[\leadsto \sin ky \cdot \frac{1}{\color{blue}{\frac{\sqrt{\sin kx \cdot \sin kx + \sin ky \cdot \sin ky}}{\sin th}}} \]
                            4. div-invN/A

                              \[\leadsto \frac{\sin ky}{\color{blue}{\frac{\sqrt{\sin kx \cdot \sin kx + \sin ky \cdot \sin ky}}{\sin th}}} \]
                            5. /-lowering-/.f64N/A

                              \[\leadsto \mathsf{/.f64}\left(\sin ky, \color{blue}{\left(\frac{\sqrt{\sin kx \cdot \sin kx + \sin ky \cdot \sin ky}}{\sin th}\right)}\right) \]
                            6. sin-lowering-sin.f64N/A

                              \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \left(\frac{\color{blue}{\sqrt{\sin kx \cdot \sin kx + \sin ky \cdot \sin ky}}}{\sin th}\right)\right) \]
                            7. /-lowering-/.f64N/A

                              \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{/.f64}\left(\left(\sqrt{\sin kx \cdot \sin kx + \sin ky \cdot \sin ky}\right), \color{blue}{\sin th}\right)\right) \]
                            8. accelerator-lowering-hypot.f64N/A

                              \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\sin kx, \sin ky\right), \sin \color{blue}{th}\right)\right) \]
                            9. sin-lowering-sin.f64N/A

                              \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \sin ky\right), \sin th\right)\right) \]
                            10. sin-lowering-sin.f64N/A

                              \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right), \sin th\right)\right) \]
                            11. sin-lowering-sin.f6499.4%

                              \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right), \mathsf{sin.f64}\left(th\right)\right)\right) \]
                          6. Applied egg-rr99.4%

                            \[\leadsto \color{blue}{\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{\sin th}}} \]
                          7. Taylor expanded in ky around 0

                            \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \color{blue}{ky}\right), \mathsf{sin.f64}\left(th\right)\right)\right) \]
                          8. Step-by-step derivation
                            1. Simplified59.1%

                              \[\leadsto \frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin kx, \color{blue}{ky}\right)}{\sin th}} \]
                          9. Recombined 3 regimes into one program.
                          10. Final simplification66.4%

                            \[\leadsto \begin{array}{l} \mathbf{if}\;th \leq 75000000:\\ \;\;\;\;th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\ \mathbf{elif}\;th \leq 5.5 \cdot 10^{+116}:\\ \;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(kx, \sin ky\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin kx, ky\right)}{\sin th}}\\ \end{array} \]
                          11. Add Preprocessing

                          Alternative 8: 63.4% accurate, 1.7× speedup?

                          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;th \leq 75000000:\\ \;\;\;\;th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\ \mathbf{elif}\;th \leq 3.4 \cdot 10^{+116}:\\ \;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(kx, \sin ky\right)}\\ \mathbf{else}:\\ \;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(ky, \sin kx\right)}\\ \end{array} \end{array} \]
                          (FPCore (kx ky th)
                           :precision binary64
                           (if (<= th 75000000.0)
                             (* th (/ (sin ky) (hypot (sin ky) (sin kx))))
                             (if (<= th 3.4e+116)
                               (* (sin ky) (/ (sin th) (hypot kx (sin ky))))
                               (* (sin th) (/ (sin ky) (hypot ky (sin kx)))))))
                          double code(double kx, double ky, double th) {
                          	double tmp;
                          	if (th <= 75000000.0) {
                          		tmp = th * (sin(ky) / hypot(sin(ky), sin(kx)));
                          	} else if (th <= 3.4e+116) {
                          		tmp = sin(ky) * (sin(th) / hypot(kx, sin(ky)));
                          	} else {
                          		tmp = sin(th) * (sin(ky) / hypot(ky, sin(kx)));
                          	}
                          	return tmp;
                          }
                          
                          public static double code(double kx, double ky, double th) {
                          	double tmp;
                          	if (th <= 75000000.0) {
                          		tmp = th * (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx)));
                          	} else if (th <= 3.4e+116) {
                          		tmp = Math.sin(ky) * (Math.sin(th) / Math.hypot(kx, Math.sin(ky)));
                          	} else {
                          		tmp = Math.sin(th) * (Math.sin(ky) / Math.hypot(ky, Math.sin(kx)));
                          	}
                          	return tmp;
                          }
                          
                          def code(kx, ky, th):
                          	tmp = 0
                          	if th <= 75000000.0:
                          		tmp = th * (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx)))
                          	elif th <= 3.4e+116:
                          		tmp = math.sin(ky) * (math.sin(th) / math.hypot(kx, math.sin(ky)))
                          	else:
                          		tmp = math.sin(th) * (math.sin(ky) / math.hypot(ky, math.sin(kx)))
                          	return tmp
                          
                          function code(kx, ky, th)
                          	tmp = 0.0
                          	if (th <= 75000000.0)
                          		tmp = Float64(th * Float64(sin(ky) / hypot(sin(ky), sin(kx))));
                          	elseif (th <= 3.4e+116)
                          		tmp = Float64(sin(ky) * Float64(sin(th) / hypot(kx, sin(ky))));
                          	else
                          		tmp = Float64(sin(th) * Float64(sin(ky) / hypot(ky, sin(kx))));
                          	end
                          	return tmp
                          end
                          
                          function tmp_2 = code(kx, ky, th)
                          	tmp = 0.0;
                          	if (th <= 75000000.0)
                          		tmp = th * (sin(ky) / hypot(sin(ky), sin(kx)));
                          	elseif (th <= 3.4e+116)
                          		tmp = sin(ky) * (sin(th) / hypot(kx, sin(ky)));
                          	else
                          		tmp = sin(th) * (sin(ky) / hypot(ky, sin(kx)));
                          	end
                          	tmp_2 = tmp;
                          end
                          
                          code[kx_, ky_, th_] := If[LessEqual[th, 75000000.0], N[(th * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[th, 3.4e+116], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[kx ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
                          
                          \begin{array}{l}
                          
                          \\
                          \begin{array}{l}
                          \mathbf{if}\;th \leq 75000000:\\
                          \;\;\;\;th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
                          
                          \mathbf{elif}\;th \leq 3.4 \cdot 10^{+116}:\\
                          \;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(kx, \sin ky\right)}\\
                          
                          \mathbf{else}:\\
                          \;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
                          
                          
                          \end{array}
                          \end{array}
                          
                          Derivation
                          1. Split input into 3 regimes
                          2. if th < 7.5e7

                            1. Initial program 92.5%

                              \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
                            2. Add Preprocessing
                            3. Step-by-step derivation
                              1. +-commutativeN/A

                                \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \left(\sqrt{{\sin ky}^{2} + {\sin kx}^{2}}\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                              2. unpow2N/A

                                \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \left(\sqrt{\sin ky \cdot \sin ky + {\sin kx}^{2}}\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                              3. unpow2N/A

                                \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \left(\sqrt{\sin ky \cdot \sin ky + \sin kx \cdot \sin kx}\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                              4. accelerator-lowering-hypot.f64N/A

                                \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{hypot.f64}\left(\sin ky, \sin kx\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                              5. sin-lowering-sin.f64N/A

                                \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(ky\right), \sin kx\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                              6. sin-lowering-sin.f6499.6%

                                \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{sin.f64}\left(kx\right)\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                            4. Applied egg-rr99.6%

                              \[\leadsto \frac{\sin ky}{\color{blue}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}} \cdot \sin th \]
                            5. Taylor expanded in th around 0

                              \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{sin.f64}\left(kx\right)\right)\right), \color{blue}{th}\right) \]
                            6. Step-by-step derivation
                              1. Simplified68.5%

                                \[\leadsto \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \color{blue}{th} \]

                              if 7.5e7 < th < 3.40000000000000023e116

                              1. Initial program 90.7%

                                \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
                              2. Add Preprocessing
                              3. Step-by-step derivation
                                1. associate-*l/N/A

                                  \[\leadsto \frac{\sin ky \cdot \sin th}{\color{blue}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
                                2. associate-/l*N/A

                                  \[\leadsto \sin ky \cdot \color{blue}{\frac{\sin th}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
                                3. *-commutativeN/A

                                  \[\leadsto \frac{\sin th}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \color{blue}{\sin ky} \]
                                4. *-lowering-*.f64N/A

                                  \[\leadsto \mathsf{*.f64}\left(\left(\frac{\sin th}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\right), \color{blue}{\sin ky}\right) \]
                                5. /-lowering-/.f64N/A

                                  \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\sin th, \left(\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)\right), \sin \color{blue}{ky}\right) \]
                                6. sin-lowering-sin.f64N/A

                                  \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \left(\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)\right), \sin ky\right) \]
                                7. unpow2N/A

                                  \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \left(\sqrt{\sin kx \cdot \sin kx + {\sin ky}^{2}}\right)\right), \sin ky\right) \]
                                8. unpow2N/A

                                  \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \left(\sqrt{\sin kx \cdot \sin kx + \sin ky \cdot \sin ky}\right)\right), \sin ky\right) \]
                                9. accelerator-lowering-hypot.f64N/A

                                  \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{hypot.f64}\left(\sin kx, \sin ky\right)\right), \sin ky\right) \]
                                10. sin-lowering-sin.f64N/A

                                  \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \sin ky\right)\right), \sin ky\right) \]
                                11. sin-lowering-sin.f64N/A

                                  \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right)\right), \sin ky\right) \]
                                12. sin-lowering-sin.f6499.4%

                                  \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right)\right), \mathsf{sin.f64}\left(ky\right)\right) \]
                              4. Applied egg-rr99.4%

                                \[\leadsto \color{blue}{\frac{\sin th}{\mathsf{hypot}\left(\sin kx, \sin ky\right)} \cdot \sin ky} \]
                              5. Taylor expanded in kx around 0

                                \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{hypot.f64}\left(\color{blue}{kx}, \mathsf{sin.f64}\left(ky\right)\right)\right), \mathsf{sin.f64}\left(ky\right)\right) \]
                              6. Step-by-step derivation
                                1. Simplified61.3%

                                  \[\leadsto \frac{\sin th}{\mathsf{hypot}\left(\color{blue}{kx}, \sin ky\right)} \cdot \sin ky \]

                                if 3.40000000000000023e116 < th

                                1. Initial program 82.6%

                                  \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
                                2. Add Preprocessing
                                3. Step-by-step derivation
                                  1. +-commutativeN/A

                                    \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \left(\sqrt{{\sin ky}^{2} + {\sin kx}^{2}}\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                                  2. unpow2N/A

                                    \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \left(\sqrt{\sin ky \cdot \sin ky + {\sin kx}^{2}}\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                                  3. unpow2N/A

                                    \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \left(\sqrt{\sin ky \cdot \sin ky + \sin kx \cdot \sin kx}\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                                  4. accelerator-lowering-hypot.f64N/A

                                    \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{hypot.f64}\left(\sin ky, \sin kx\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                                  5. sin-lowering-sin.f64N/A

                                    \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(ky\right), \sin kx\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                                  6. sin-lowering-sin.f6499.5%

                                    \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{sin.f64}\left(kx\right)\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                                4. Applied egg-rr99.5%

                                  \[\leadsto \frac{\sin ky}{\color{blue}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}} \cdot \sin th \]
                                5. Taylor expanded in ky around 0

                                  \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{hypot.f64}\left(\color{blue}{ky}, \mathsf{sin.f64}\left(kx\right)\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                                6. Step-by-step derivation
                                  1. Simplified59.0%

                                    \[\leadsto \frac{\sin ky}{\mathsf{hypot}\left(\color{blue}{ky}, \sin kx\right)} \cdot \sin th \]
                                7. Recombined 3 regimes into one program.
                                8. Final simplification66.4%

                                  \[\leadsto \begin{array}{l} \mathbf{if}\;th \leq 75000000:\\ \;\;\;\;th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\ \mathbf{elif}\;th \leq 3.4 \cdot 10^{+116}:\\ \;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(kx, \sin ky\right)}\\ \mathbf{else}:\\ \;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(ky, \sin kx\right)}\\ \end{array} \]
                                9. Add Preprocessing

                                Alternative 9: 63.5% accurate, 1.7× speedup?

                                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;th \leq 0.0025:\\ \;\;\;\;th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\ \mathbf{else}:\\ \;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(ky, \sin kx\right)}\\ \end{array} \end{array} \]
                                (FPCore (kx ky th)
                                 :precision binary64
                                 (if (<= th 0.0025)
                                   (* th (/ (sin ky) (hypot (sin ky) (sin kx))))
                                   (* (sin th) (/ (sin ky) (hypot ky (sin kx))))))
                                double code(double kx, double ky, double th) {
                                	double tmp;
                                	if (th <= 0.0025) {
                                		tmp = th * (sin(ky) / hypot(sin(ky), sin(kx)));
                                	} else {
                                		tmp = sin(th) * (sin(ky) / hypot(ky, sin(kx)));
                                	}
                                	return tmp;
                                }
                                
                                public static double code(double kx, double ky, double th) {
                                	double tmp;
                                	if (th <= 0.0025) {
                                		tmp = th * (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx)));
                                	} else {
                                		tmp = Math.sin(th) * (Math.sin(ky) / Math.hypot(ky, Math.sin(kx)));
                                	}
                                	return tmp;
                                }
                                
                                def code(kx, ky, th):
                                	tmp = 0
                                	if th <= 0.0025:
                                		tmp = th * (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx)))
                                	else:
                                		tmp = math.sin(th) * (math.sin(ky) / math.hypot(ky, math.sin(kx)))
                                	return tmp
                                
                                function code(kx, ky, th)
                                	tmp = 0.0
                                	if (th <= 0.0025)
                                		tmp = Float64(th * Float64(sin(ky) / hypot(sin(ky), sin(kx))));
                                	else
                                		tmp = Float64(sin(th) * Float64(sin(ky) / hypot(ky, sin(kx))));
                                	end
                                	return tmp
                                end
                                
                                function tmp_2 = code(kx, ky, th)
                                	tmp = 0.0;
                                	if (th <= 0.0025)
                                		tmp = th * (sin(ky) / hypot(sin(ky), sin(kx)));
                                	else
                                		tmp = sin(th) * (sin(ky) / hypot(ky, sin(kx)));
                                	end
                                	tmp_2 = tmp;
                                end
                                
                                code[kx_, ky_, th_] := If[LessEqual[th, 0.0025], N[(th * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                                
                                \begin{array}{l}
                                
                                \\
                                \begin{array}{l}
                                \mathbf{if}\;th \leq 0.0025:\\
                                \;\;\;\;th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
                                
                                \mathbf{else}:\\
                                \;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
                                
                                
                                \end{array}
                                \end{array}
                                
                                Derivation
                                1. Split input into 2 regimes
                                2. if th < 0.00250000000000000005

                                  1. Initial program 92.4%

                                    \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
                                  2. Add Preprocessing
                                  3. Step-by-step derivation
                                    1. +-commutativeN/A

                                      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \left(\sqrt{{\sin ky}^{2} + {\sin kx}^{2}}\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                                    2. unpow2N/A

                                      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \left(\sqrt{\sin ky \cdot \sin ky + {\sin kx}^{2}}\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                                    3. unpow2N/A

                                      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \left(\sqrt{\sin ky \cdot \sin ky + \sin kx \cdot \sin kx}\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                                    4. accelerator-lowering-hypot.f64N/A

                                      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{hypot.f64}\left(\sin ky, \sin kx\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                                    5. sin-lowering-sin.f64N/A

                                      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(ky\right), \sin kx\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                                    6. sin-lowering-sin.f6499.7%

                                      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{sin.f64}\left(kx\right)\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                                  4. Applied egg-rr99.7%

                                    \[\leadsto \frac{\sin ky}{\color{blue}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}} \cdot \sin th \]
                                  5. Taylor expanded in th around 0

                                    \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{sin.f64}\left(kx\right)\right)\right), \color{blue}{th}\right) \]
                                  6. Step-by-step derivation
                                    1. Simplified68.8%

                                      \[\leadsto \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \color{blue}{th} \]

                                    if 0.00250000000000000005 < th

                                    1. Initial program 85.7%

                                      \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
                                    2. Add Preprocessing
                                    3. Step-by-step derivation
                                      1. +-commutativeN/A

                                        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \left(\sqrt{{\sin ky}^{2} + {\sin kx}^{2}}\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                                      2. unpow2N/A

                                        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \left(\sqrt{\sin ky \cdot \sin ky + {\sin kx}^{2}}\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                                      3. unpow2N/A

                                        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \left(\sqrt{\sin ky \cdot \sin ky + \sin kx \cdot \sin kx}\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                                      4. accelerator-lowering-hypot.f64N/A

                                        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{hypot.f64}\left(\sin ky, \sin kx\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                                      5. sin-lowering-sin.f64N/A

                                        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(ky\right), \sin kx\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                                      6. sin-lowering-sin.f6499.6%

                                        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{sin.f64}\left(kx\right)\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                                    4. Applied egg-rr99.6%

                                      \[\leadsto \frac{\sin ky}{\color{blue}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}} \cdot \sin th \]
                                    5. Taylor expanded in ky around 0

                                      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{hypot.f64}\left(\color{blue}{ky}, \mathsf{sin.f64}\left(kx\right)\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                                    6. Step-by-step derivation
                                      1. Simplified53.9%

                                        \[\leadsto \frac{\sin ky}{\mathsf{hypot}\left(\color{blue}{ky}, \sin kx\right)} \cdot \sin th \]
                                    7. Recombined 2 regimes into one program.
                                    8. Final simplification65.1%

                                      \[\leadsto \begin{array}{l} \mathbf{if}\;th \leq 0.0025:\\ \;\;\;\;th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\ \mathbf{else}:\\ \;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(ky, \sin kx\right)}\\ \end{array} \]
                                    9. Add Preprocessing

                                    Alternative 10: 63.4% accurate, 1.7× speedup?

                                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;th \leq 0.00031:\\ \;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\\ \mathbf{else}:\\ \;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(ky, \sin kx\right)}\\ \end{array} \end{array} \]
                                    (FPCore (kx ky th)
                                     :precision binary64
                                     (if (<= th 0.00031)
                                       (* (sin ky) (/ th (hypot (sin kx) (sin ky))))
                                       (* (sin th) (/ (sin ky) (hypot ky (sin kx))))))
                                    double code(double kx, double ky, double th) {
                                    	double tmp;
                                    	if (th <= 0.00031) {
                                    		tmp = sin(ky) * (th / hypot(sin(kx), sin(ky)));
                                    	} else {
                                    		tmp = sin(th) * (sin(ky) / hypot(ky, sin(kx)));
                                    	}
                                    	return tmp;
                                    }
                                    
                                    public static double code(double kx, double ky, double th) {
                                    	double tmp;
                                    	if (th <= 0.00031) {
                                    		tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(kx), Math.sin(ky)));
                                    	} else {
                                    		tmp = Math.sin(th) * (Math.sin(ky) / Math.hypot(ky, Math.sin(kx)));
                                    	}
                                    	return tmp;
                                    }
                                    
                                    def code(kx, ky, th):
                                    	tmp = 0
                                    	if th <= 0.00031:
                                    		tmp = math.sin(ky) * (th / math.hypot(math.sin(kx), math.sin(ky)))
                                    	else:
                                    		tmp = math.sin(th) * (math.sin(ky) / math.hypot(ky, math.sin(kx)))
                                    	return tmp
                                    
                                    function code(kx, ky, th)
                                    	tmp = 0.0
                                    	if (th <= 0.00031)
                                    		tmp = Float64(sin(ky) * Float64(th / hypot(sin(kx), sin(ky))));
                                    	else
                                    		tmp = Float64(sin(th) * Float64(sin(ky) / hypot(ky, sin(kx))));
                                    	end
                                    	return tmp
                                    end
                                    
                                    function tmp_2 = code(kx, ky, th)
                                    	tmp = 0.0;
                                    	if (th <= 0.00031)
                                    		tmp = sin(ky) * (th / hypot(sin(kx), sin(ky)));
                                    	else
                                    		tmp = sin(th) * (sin(ky) / hypot(ky, sin(kx)));
                                    	end
                                    	tmp_2 = tmp;
                                    end
                                    
                                    code[kx_, ky_, th_] := If[LessEqual[th, 0.00031], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                                    
                                    \begin{array}{l}
                                    
                                    \\
                                    \begin{array}{l}
                                    \mathbf{if}\;th \leq 0.00031:\\
                                    \;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\\
                                    
                                    \mathbf{else}:\\
                                    \;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
                                    
                                    
                                    \end{array}
                                    \end{array}
                                    
                                    Derivation
                                    1. Split input into 2 regimes
                                    2. if th < 3.1e-4

                                      1. Initial program 92.4%

                                        \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
                                      2. Add Preprocessing
                                      3. Step-by-step derivation
                                        1. associate-*l/N/A

                                          \[\leadsto \frac{\sin ky \cdot \sin th}{\color{blue}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
                                        2. associate-/l*N/A

                                          \[\leadsto \sin ky \cdot \color{blue}{\frac{\sin th}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
                                        3. *-commutativeN/A

                                          \[\leadsto \frac{\sin th}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \color{blue}{\sin ky} \]
                                        4. *-lowering-*.f64N/A

                                          \[\leadsto \mathsf{*.f64}\left(\left(\frac{\sin th}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\right), \color{blue}{\sin ky}\right) \]
                                        5. /-lowering-/.f64N/A

                                          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\sin th, \left(\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)\right), \sin \color{blue}{ky}\right) \]
                                        6. sin-lowering-sin.f64N/A

                                          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \left(\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)\right), \sin ky\right) \]
                                        7. unpow2N/A

                                          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \left(\sqrt{\sin kx \cdot \sin kx + {\sin ky}^{2}}\right)\right), \sin ky\right) \]
                                        8. unpow2N/A

                                          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \left(\sqrt{\sin kx \cdot \sin kx + \sin ky \cdot \sin ky}\right)\right), \sin ky\right) \]
                                        9. accelerator-lowering-hypot.f64N/A

                                          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{hypot.f64}\left(\sin kx, \sin ky\right)\right), \sin ky\right) \]
                                        10. sin-lowering-sin.f64N/A

                                          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \sin ky\right)\right), \sin ky\right) \]
                                        11. sin-lowering-sin.f64N/A

                                          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right)\right), \sin ky\right) \]
                                        12. sin-lowering-sin.f6499.6%

                                          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right)\right), \mathsf{sin.f64}\left(ky\right)\right) \]
                                      4. Applied egg-rr99.6%

                                        \[\leadsto \color{blue}{\frac{\sin th}{\mathsf{hypot}\left(\sin kx, \sin ky\right)} \cdot \sin ky} \]
                                      5. Taylor expanded in th around 0

                                        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\color{blue}{th}, \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right)\right), \mathsf{sin.f64}\left(ky\right)\right) \]
                                      6. Step-by-step derivation
                                        1. Simplified68.7%

                                          \[\leadsto \frac{\color{blue}{th}}{\mathsf{hypot}\left(\sin kx, \sin ky\right)} \cdot \sin ky \]

                                        if 3.1e-4 < th

                                        1. Initial program 85.7%

                                          \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
                                        2. Add Preprocessing
                                        3. Step-by-step derivation
                                          1. +-commutativeN/A

                                            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \left(\sqrt{{\sin ky}^{2} + {\sin kx}^{2}}\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                                          2. unpow2N/A

                                            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \left(\sqrt{\sin ky \cdot \sin ky + {\sin kx}^{2}}\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                                          3. unpow2N/A

                                            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \left(\sqrt{\sin ky \cdot \sin ky + \sin kx \cdot \sin kx}\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                                          4. accelerator-lowering-hypot.f64N/A

                                            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{hypot.f64}\left(\sin ky, \sin kx\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                                          5. sin-lowering-sin.f64N/A

                                            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(ky\right), \sin kx\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                                          6. sin-lowering-sin.f6499.6%

                                            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{sin.f64}\left(kx\right)\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                                        4. Applied egg-rr99.6%

                                          \[\leadsto \frac{\sin ky}{\color{blue}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}} \cdot \sin th \]
                                        5. Taylor expanded in ky around 0

                                          \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{hypot.f64}\left(\color{blue}{ky}, \mathsf{sin.f64}\left(kx\right)\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                                        6. Step-by-step derivation
                                          1. Simplified53.9%

                                            \[\leadsto \frac{\sin ky}{\mathsf{hypot}\left(\color{blue}{ky}, \sin kx\right)} \cdot \sin th \]
                                        7. Recombined 2 regimes into one program.
                                        8. Final simplification65.0%

                                          \[\leadsto \begin{array}{l} \mathbf{if}\;th \leq 0.00031:\\ \;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\\ \mathbf{else}:\\ \;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(ky, \sin kx\right)}\\ \end{array} \]
                                        9. Add Preprocessing

                                        Alternative 11: 56.1% accurate, 1.7× speedup?

                                        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;th \leq 75000000:\\ \;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\\ \mathbf{elif}\;th \leq 1.16 \cdot 10^{+73}:\\ \;\;\;\;\sin th\\ \mathbf{else}:\\ \;\;\;\;\frac{\sin th}{\frac{\sin kx}{\sin ky}}\\ \end{array} \end{array} \]
                                        (FPCore (kx ky th)
                                         :precision binary64
                                         (if (<= th 75000000.0)
                                           (* (sin ky) (/ th (hypot (sin kx) (sin ky))))
                                           (if (<= th 1.16e+73) (sin th) (/ (sin th) (/ (sin kx) (sin ky))))))
                                        double code(double kx, double ky, double th) {
                                        	double tmp;
                                        	if (th <= 75000000.0) {
                                        		tmp = sin(ky) * (th / hypot(sin(kx), sin(ky)));
                                        	} else if (th <= 1.16e+73) {
                                        		tmp = sin(th);
                                        	} else {
                                        		tmp = sin(th) / (sin(kx) / sin(ky));
                                        	}
                                        	return tmp;
                                        }
                                        
                                        public static double code(double kx, double ky, double th) {
                                        	double tmp;
                                        	if (th <= 75000000.0) {
                                        		tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(kx), Math.sin(ky)));
                                        	} else if (th <= 1.16e+73) {
                                        		tmp = Math.sin(th);
                                        	} else {
                                        		tmp = Math.sin(th) / (Math.sin(kx) / Math.sin(ky));
                                        	}
                                        	return tmp;
                                        }
                                        
                                        def code(kx, ky, th):
                                        	tmp = 0
                                        	if th <= 75000000.0:
                                        		tmp = math.sin(ky) * (th / math.hypot(math.sin(kx), math.sin(ky)))
                                        	elif th <= 1.16e+73:
                                        		tmp = math.sin(th)
                                        	else:
                                        		tmp = math.sin(th) / (math.sin(kx) / math.sin(ky))
                                        	return tmp
                                        
                                        function code(kx, ky, th)
                                        	tmp = 0.0
                                        	if (th <= 75000000.0)
                                        		tmp = Float64(sin(ky) * Float64(th / hypot(sin(kx), sin(ky))));
                                        	elseif (th <= 1.16e+73)
                                        		tmp = sin(th);
                                        	else
                                        		tmp = Float64(sin(th) / Float64(sin(kx) / sin(ky)));
                                        	end
                                        	return tmp
                                        end
                                        
                                        function tmp_2 = code(kx, ky, th)
                                        	tmp = 0.0;
                                        	if (th <= 75000000.0)
                                        		tmp = sin(ky) * (th / hypot(sin(kx), sin(ky)));
                                        	elseif (th <= 1.16e+73)
                                        		tmp = sin(th);
                                        	else
                                        		tmp = sin(th) / (sin(kx) / sin(ky));
                                        	end
                                        	tmp_2 = tmp;
                                        end
                                        
                                        code[kx_, ky_, th_] := If[LessEqual[th, 75000000.0], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[th, 1.16e+73], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
                                        
                                        \begin{array}{l}
                                        
                                        \\
                                        \begin{array}{l}
                                        \mathbf{if}\;th \leq 75000000:\\
                                        \;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\\
                                        
                                        \mathbf{elif}\;th \leq 1.16 \cdot 10^{+73}:\\
                                        \;\;\;\;\sin th\\
                                        
                                        \mathbf{else}:\\
                                        \;\;\;\;\frac{\sin th}{\frac{\sin kx}{\sin ky}}\\
                                        
                                        
                                        \end{array}
                                        \end{array}
                                        
                                        Derivation
                                        1. Split input into 3 regimes
                                        2. if th < 7.5e7

                                          1. Initial program 92.5%

                                            \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
                                          2. Add Preprocessing
                                          3. Step-by-step derivation
                                            1. associate-*l/N/A

                                              \[\leadsto \frac{\sin ky \cdot \sin th}{\color{blue}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
                                            2. associate-/l*N/A

                                              \[\leadsto \sin ky \cdot \color{blue}{\frac{\sin th}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
                                            3. *-commutativeN/A

                                              \[\leadsto \frac{\sin th}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \color{blue}{\sin ky} \]
                                            4. *-lowering-*.f64N/A

                                              \[\leadsto \mathsf{*.f64}\left(\left(\frac{\sin th}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\right), \color{blue}{\sin ky}\right) \]
                                            5. /-lowering-/.f64N/A

                                              \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\sin th, \left(\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)\right), \sin \color{blue}{ky}\right) \]
                                            6. sin-lowering-sin.f64N/A

                                              \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \left(\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)\right), \sin ky\right) \]
                                            7. unpow2N/A

                                              \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \left(\sqrt{\sin kx \cdot \sin kx + {\sin ky}^{2}}\right)\right), \sin ky\right) \]
                                            8. unpow2N/A

                                              \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \left(\sqrt{\sin kx \cdot \sin kx + \sin ky \cdot \sin ky}\right)\right), \sin ky\right) \]
                                            9. accelerator-lowering-hypot.f64N/A

                                              \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{hypot.f64}\left(\sin kx, \sin ky\right)\right), \sin ky\right) \]
                                            10. sin-lowering-sin.f64N/A

                                              \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \sin ky\right)\right), \sin ky\right) \]
                                            11. sin-lowering-sin.f64N/A

                                              \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right)\right), \sin ky\right) \]
                                            12. sin-lowering-sin.f6499.6%

                                              \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right)\right), \mathsf{sin.f64}\left(ky\right)\right) \]
                                          4. Applied egg-rr99.6%

                                            \[\leadsto \color{blue}{\frac{\sin th}{\mathsf{hypot}\left(\sin kx, \sin ky\right)} \cdot \sin ky} \]
                                          5. Taylor expanded in th around 0

                                            \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\color{blue}{th}, \mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right)\right), \mathsf{sin.f64}\left(ky\right)\right) \]
                                          6. Step-by-step derivation
                                            1. Simplified68.4%

                                              \[\leadsto \frac{\color{blue}{th}}{\mathsf{hypot}\left(\sin kx, \sin ky\right)} \cdot \sin ky \]

                                            if 7.5e7 < th < 1.16000000000000007e73

                                            1. Initial program 89.9%

                                              \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
                                            2. Add Preprocessing
                                            3. Taylor expanded in kx around 0

                                              \[\leadsto \color{blue}{\sin th} \]
                                            4. Step-by-step derivation
                                              1. sin-lowering-sin.f6433.1%

                                                \[\leadsto \mathsf{sin.f64}\left(th\right) \]
                                            5. Simplified33.1%

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

                                            if 1.16000000000000007e73 < th

                                            1. Initial program 84.6%

                                              \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
                                            2. Add Preprocessing
                                            3. Step-by-step derivation
                                              1. *-commutativeN/A

                                                \[\leadsto \sin th \cdot \color{blue}{\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
                                              2. clear-numN/A

                                                \[\leadsto \sin th \cdot \frac{1}{\color{blue}{\frac{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}{\sin ky}}} \]
                                              3. un-div-invN/A

                                                \[\leadsto \frac{\sin th}{\color{blue}{\frac{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}{\sin ky}}} \]
                                              4. /-lowering-/.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\sin th, \color{blue}{\left(\frac{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}{\sin ky}\right)}\right) \]
                                              5. sin-lowering-sin.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \left(\frac{\color{blue}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}}{\sin ky}\right)\right) \]
                                              6. /-lowering-/.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right), \color{blue}{\sin ky}\right)\right) \]
                                              7. unpow2N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sqrt{\sin kx \cdot \sin kx + {\sin ky}^{2}}\right), \sin ky\right)\right) \]
                                              8. unpow2N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sqrt{\sin kx \cdot \sin kx + \sin ky \cdot \sin ky}\right), \sin ky\right)\right) \]
                                              9. accelerator-lowering-hypot.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\sin kx, \sin ky\right), \sin \color{blue}{ky}\right)\right) \]
                                              10. sin-lowering-sin.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \sin ky\right), \sin ky\right)\right) \]
                                              11. sin-lowering-sin.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right), \sin ky\right)\right) \]
                                              12. sin-lowering-sin.f6499.6%

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right), \mathsf{sin.f64}\left(ky\right)\right)\right) \]
                                            4. Applied egg-rr99.6%

                                              \[\leadsto \color{blue}{\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{\sin ky}}} \]
                                            5. Taylor expanded in ky around 0

                                              \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\color{blue}{\sin kx}, \mathsf{sin.f64}\left(ky\right)\right)\right) \]
                                            6. Step-by-step derivation
                                              1. sin-lowering-sin.f6418.0%

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(\color{blue}{ky}\right)\right)\right) \]
                                            7. Simplified18.0%

                                              \[\leadsto \frac{\sin th}{\frac{\color{blue}{\sin kx}}{\sin ky}} \]
                                          7. Recombined 3 regimes into one program.
                                          8. Final simplification56.8%

                                            \[\leadsto \begin{array}{l} \mathbf{if}\;th \leq 75000000:\\ \;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\\ \mathbf{elif}\;th \leq 1.16 \cdot 10^{+73}:\\ \;\;\;\;\sin th\\ \mathbf{else}:\\ \;\;\;\;\frac{\sin th}{\frac{\sin kx}{\sin ky}}\\ \end{array} \]
                                          9. Add Preprocessing

                                          Alternative 12: 41.1% accurate, 1.7× speedup?

                                          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\sin ky \leq 10^{-29}:\\ \;\;\;\;\frac{\sin th}{\frac{\sin kx}{\sin ky}}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \end{array} \]
                                          (FPCore (kx ky th)
                                           :precision binary64
                                           (if (<= (sin ky) 1e-29) (/ (sin th) (/ (sin kx) (sin ky))) (sin th)))
                                          double code(double kx, double ky, double th) {
                                          	double tmp;
                                          	if (sin(ky) <= 1e-29) {
                                          		tmp = sin(th) / (sin(kx) / sin(ky));
                                          	} else {
                                          		tmp = sin(th);
                                          	}
                                          	return tmp;
                                          }
                                          
                                          real(8) function code(kx, ky, th)
                                              real(8), intent (in) :: kx
                                              real(8), intent (in) :: ky
                                              real(8), intent (in) :: th
                                              real(8) :: tmp
                                              if (sin(ky) <= 1d-29) then
                                                  tmp = sin(th) / (sin(kx) / sin(ky))
                                              else
                                                  tmp = sin(th)
                                              end if
                                              code = tmp
                                          end function
                                          
                                          public static double code(double kx, double ky, double th) {
                                          	double tmp;
                                          	if (Math.sin(ky) <= 1e-29) {
                                          		tmp = Math.sin(th) / (Math.sin(kx) / Math.sin(ky));
                                          	} else {
                                          		tmp = Math.sin(th);
                                          	}
                                          	return tmp;
                                          }
                                          
                                          def code(kx, ky, th):
                                          	tmp = 0
                                          	if math.sin(ky) <= 1e-29:
                                          		tmp = math.sin(th) / (math.sin(kx) / math.sin(ky))
                                          	else:
                                          		tmp = math.sin(th)
                                          	return tmp
                                          
                                          function code(kx, ky, th)
                                          	tmp = 0.0
                                          	if (sin(ky) <= 1e-29)
                                          		tmp = Float64(sin(th) / Float64(sin(kx) / sin(ky)));
                                          	else
                                          		tmp = sin(th);
                                          	end
                                          	return tmp
                                          end
                                          
                                          function tmp_2 = code(kx, ky, th)
                                          	tmp = 0.0;
                                          	if (sin(ky) <= 1e-29)
                                          		tmp = sin(th) / (sin(kx) / sin(ky));
                                          	else
                                          		tmp = sin(th);
                                          	end
                                          	tmp_2 = tmp;
                                          end
                                          
                                          code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-29], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
                                          
                                          \begin{array}{l}
                                          
                                          \\
                                          \begin{array}{l}
                                          \mathbf{if}\;\sin ky \leq 10^{-29}:\\
                                          \;\;\;\;\frac{\sin th}{\frac{\sin kx}{\sin ky}}\\
                                          
                                          \mathbf{else}:\\
                                          \;\;\;\;\sin th\\
                                          
                                          
                                          \end{array}
                                          \end{array}
                                          
                                          Derivation
                                          1. Split input into 2 regimes
                                          2. if (sin.f64 ky) < 9.99999999999999943e-30

                                            1. Initial program 87.7%

                                              \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
                                            2. Add Preprocessing
                                            3. Step-by-step derivation
                                              1. *-commutativeN/A

                                                \[\leadsto \sin th \cdot \color{blue}{\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
                                              2. clear-numN/A

                                                \[\leadsto \sin th \cdot \frac{1}{\color{blue}{\frac{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}{\sin ky}}} \]
                                              3. un-div-invN/A

                                                \[\leadsto \frac{\sin th}{\color{blue}{\frac{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}{\sin ky}}} \]
                                              4. /-lowering-/.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\sin th, \color{blue}{\left(\frac{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}{\sin ky}\right)}\right) \]
                                              5. sin-lowering-sin.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \left(\frac{\color{blue}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}}{\sin ky}\right)\right) \]
                                              6. /-lowering-/.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right), \color{blue}{\sin ky}\right)\right) \]
                                              7. unpow2N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sqrt{\sin kx \cdot \sin kx + {\sin ky}^{2}}\right), \sin ky\right)\right) \]
                                              8. unpow2N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sqrt{\sin kx \cdot \sin kx + \sin ky \cdot \sin ky}\right), \sin ky\right)\right) \]
                                              9. accelerator-lowering-hypot.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\sin kx, \sin ky\right), \sin \color{blue}{ky}\right)\right) \]
                                              10. sin-lowering-sin.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \sin ky\right), \sin ky\right)\right) \]
                                              11. sin-lowering-sin.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right), \sin ky\right)\right) \]
                                              12. sin-lowering-sin.f6499.7%

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right), \mathsf{sin.f64}\left(ky\right)\right)\right) \]
                                            4. Applied egg-rr99.7%

                                              \[\leadsto \color{blue}{\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{\sin ky}}} \]
                                            5. Taylor expanded in ky around 0

                                              \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\color{blue}{\sin kx}, \mathsf{sin.f64}\left(ky\right)\right)\right) \]
                                            6. Step-by-step derivation
                                              1. sin-lowering-sin.f6433.8%

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(\color{blue}{ky}\right)\right)\right) \]
                                            7. Simplified33.8%

                                              \[\leadsto \frac{\sin th}{\frac{\color{blue}{\sin kx}}{\sin ky}} \]

                                            if 9.99999999999999943e-30 < (sin.f64 ky)

                                            1. Initial program 99.6%

                                              \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
                                            2. Add Preprocessing
                                            3. Taylor expanded in kx around 0

                                              \[\leadsto \color{blue}{\sin th} \]
                                            4. Step-by-step derivation
                                              1. sin-lowering-sin.f6448.4%

                                                \[\leadsto \mathsf{sin.f64}\left(th\right) \]
                                            5. Simplified48.4%

                                              \[\leadsto \color{blue}{\sin th} \]
                                          3. Recombined 2 regimes into one program.
                                          4. Add Preprocessing

                                          Alternative 13: 41.1% accurate, 1.7× speedup?

                                          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\sin ky \leq 10^{-29}:\\ \;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \end{array} \]
                                          (FPCore (kx ky th)
                                           :precision binary64
                                           (if (<= (sin ky) 1e-29) (* (sin th) (/ (sin ky) (sin kx))) (sin th)))
                                          double code(double kx, double ky, double th) {
                                          	double tmp;
                                          	if (sin(ky) <= 1e-29) {
                                          		tmp = sin(th) * (sin(ky) / sin(kx));
                                          	} else {
                                          		tmp = sin(th);
                                          	}
                                          	return tmp;
                                          }
                                          
                                          real(8) function code(kx, ky, th)
                                              real(8), intent (in) :: kx
                                              real(8), intent (in) :: ky
                                              real(8), intent (in) :: th
                                              real(8) :: tmp
                                              if (sin(ky) <= 1d-29) then
                                                  tmp = sin(th) * (sin(ky) / sin(kx))
                                              else
                                                  tmp = sin(th)
                                              end if
                                              code = tmp
                                          end function
                                          
                                          public static double code(double kx, double ky, double th) {
                                          	double tmp;
                                          	if (Math.sin(ky) <= 1e-29) {
                                          		tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
                                          	} else {
                                          		tmp = Math.sin(th);
                                          	}
                                          	return tmp;
                                          }
                                          
                                          def code(kx, ky, th):
                                          	tmp = 0
                                          	if math.sin(ky) <= 1e-29:
                                          		tmp = math.sin(th) * (math.sin(ky) / math.sin(kx))
                                          	else:
                                          		tmp = math.sin(th)
                                          	return tmp
                                          
                                          function code(kx, ky, th)
                                          	tmp = 0.0
                                          	if (sin(ky) <= 1e-29)
                                          		tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx)));
                                          	else
                                          		tmp = sin(th);
                                          	end
                                          	return tmp
                                          end
                                          
                                          function tmp_2 = code(kx, ky, th)
                                          	tmp = 0.0;
                                          	if (sin(ky) <= 1e-29)
                                          		tmp = sin(th) * (sin(ky) / sin(kx));
                                          	else
                                          		tmp = sin(th);
                                          	end
                                          	tmp_2 = tmp;
                                          end
                                          
                                          code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-29], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
                                          
                                          \begin{array}{l}
                                          
                                          \\
                                          \begin{array}{l}
                                          \mathbf{if}\;\sin ky \leq 10^{-29}:\\
                                          \;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
                                          
                                          \mathbf{else}:\\
                                          \;\;\;\;\sin th\\
                                          
                                          
                                          \end{array}
                                          \end{array}
                                          
                                          Derivation
                                          1. Split input into 2 regimes
                                          2. if (sin.f64 ky) < 9.99999999999999943e-30

                                            1. Initial program 87.7%

                                              \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
                                            2. Add Preprocessing
                                            3. Taylor expanded in ky around 0

                                              \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \color{blue}{\sin kx}\right), \mathsf{sin.f64}\left(th\right)\right) \]
                                            4. Step-by-step derivation
                                              1. sin-lowering-sin.f6433.8%

                                                \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{sin.f64}\left(kx\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                                            5. Simplified33.8%

                                              \[\leadsto \frac{\sin ky}{\color{blue}{\sin kx}} \cdot \sin th \]

                                            if 9.99999999999999943e-30 < (sin.f64 ky)

                                            1. Initial program 99.6%

                                              \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
                                            2. Add Preprocessing
                                            3. Taylor expanded in kx around 0

                                              \[\leadsto \color{blue}{\sin th} \]
                                            4. Step-by-step derivation
                                              1. sin-lowering-sin.f6448.4%

                                                \[\leadsto \mathsf{sin.f64}\left(th\right) \]
                                            5. Simplified48.4%

                                              \[\leadsto \color{blue}{\sin th} \]
                                          3. Recombined 2 regimes into one program.
                                          4. Final simplification37.6%

                                            \[\leadsto \begin{array}{l} \mathbf{if}\;\sin ky \leq 10^{-29}:\\ \;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
                                          5. Add Preprocessing

                                          Alternative 14: 40.3% accurate, 2.2× speedup?

                                          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\sin ky \leq 10^{-29}:\\ \;\;\;\;\frac{\sin th}{\frac{\sin kx \cdot \left(1 + 0.16666666666666666 \cdot \left(ky \cdot ky\right)\right)}{ky}}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \end{array} \]
                                          (FPCore (kx ky th)
                                           :precision binary64
                                           (if (<= (sin ky) 1e-29)
                                             (/ (sin th) (/ (* (sin kx) (+ 1.0 (* 0.16666666666666666 (* ky ky)))) ky))
                                             (sin th)))
                                          double code(double kx, double ky, double th) {
                                          	double tmp;
                                          	if (sin(ky) <= 1e-29) {
                                          		tmp = sin(th) / ((sin(kx) * (1.0 + (0.16666666666666666 * (ky * ky)))) / ky);
                                          	} else {
                                          		tmp = sin(th);
                                          	}
                                          	return tmp;
                                          }
                                          
                                          real(8) function code(kx, ky, th)
                                              real(8), intent (in) :: kx
                                              real(8), intent (in) :: ky
                                              real(8), intent (in) :: th
                                              real(8) :: tmp
                                              if (sin(ky) <= 1d-29) then
                                                  tmp = sin(th) / ((sin(kx) * (1.0d0 + (0.16666666666666666d0 * (ky * ky)))) / ky)
                                              else
                                                  tmp = sin(th)
                                              end if
                                              code = tmp
                                          end function
                                          
                                          public static double code(double kx, double ky, double th) {
                                          	double tmp;
                                          	if (Math.sin(ky) <= 1e-29) {
                                          		tmp = Math.sin(th) / ((Math.sin(kx) * (1.0 + (0.16666666666666666 * (ky * ky)))) / ky);
                                          	} else {
                                          		tmp = Math.sin(th);
                                          	}
                                          	return tmp;
                                          }
                                          
                                          def code(kx, ky, th):
                                          	tmp = 0
                                          	if math.sin(ky) <= 1e-29:
                                          		tmp = math.sin(th) / ((math.sin(kx) * (1.0 + (0.16666666666666666 * (ky * ky)))) / ky)
                                          	else:
                                          		tmp = math.sin(th)
                                          	return tmp
                                          
                                          function code(kx, ky, th)
                                          	tmp = 0.0
                                          	if (sin(ky) <= 1e-29)
                                          		tmp = Float64(sin(th) / Float64(Float64(sin(kx) * Float64(1.0 + Float64(0.16666666666666666 * Float64(ky * ky)))) / ky));
                                          	else
                                          		tmp = sin(th);
                                          	end
                                          	return tmp
                                          end
                                          
                                          function tmp_2 = code(kx, ky, th)
                                          	tmp = 0.0;
                                          	if (sin(ky) <= 1e-29)
                                          		tmp = sin(th) / ((sin(kx) * (1.0 + (0.16666666666666666 * (ky * ky)))) / ky);
                                          	else
                                          		tmp = sin(th);
                                          	end
                                          	tmp_2 = tmp;
                                          end
                                          
                                          code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-29], N[(N[Sin[th], $MachinePrecision] / N[(N[(N[Sin[kx], $MachinePrecision] * N[(1.0 + N[(0.16666666666666666 * N[(ky * ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
                                          
                                          \begin{array}{l}
                                          
                                          \\
                                          \begin{array}{l}
                                          \mathbf{if}\;\sin ky \leq 10^{-29}:\\
                                          \;\;\;\;\frac{\sin th}{\frac{\sin kx \cdot \left(1 + 0.16666666666666666 \cdot \left(ky \cdot ky\right)\right)}{ky}}\\
                                          
                                          \mathbf{else}:\\
                                          \;\;\;\;\sin th\\
                                          
                                          
                                          \end{array}
                                          \end{array}
                                          
                                          Derivation
                                          1. Split input into 2 regimes
                                          2. if (sin.f64 ky) < 9.99999999999999943e-30

                                            1. Initial program 87.7%

                                              \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
                                            2. Add Preprocessing
                                            3. Step-by-step derivation
                                              1. *-commutativeN/A

                                                \[\leadsto \sin th \cdot \color{blue}{\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
                                              2. clear-numN/A

                                                \[\leadsto \sin th \cdot \frac{1}{\color{blue}{\frac{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}{\sin ky}}} \]
                                              3. un-div-invN/A

                                                \[\leadsto \frac{\sin th}{\color{blue}{\frac{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}{\sin ky}}} \]
                                              4. /-lowering-/.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\sin th, \color{blue}{\left(\frac{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}{\sin ky}\right)}\right) \]
                                              5. sin-lowering-sin.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \left(\frac{\color{blue}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}}{\sin ky}\right)\right) \]
                                              6. /-lowering-/.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right), \color{blue}{\sin ky}\right)\right) \]
                                              7. unpow2N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sqrt{\sin kx \cdot \sin kx + {\sin ky}^{2}}\right), \sin ky\right)\right) \]
                                              8. unpow2N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sqrt{\sin kx \cdot \sin kx + \sin ky \cdot \sin ky}\right), \sin ky\right)\right) \]
                                              9. accelerator-lowering-hypot.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\sin kx, \sin ky\right), \sin \color{blue}{ky}\right)\right) \]
                                              10. sin-lowering-sin.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \sin ky\right), \sin ky\right)\right) \]
                                              11. sin-lowering-sin.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right), \sin ky\right)\right) \]
                                              12. sin-lowering-sin.f6499.7%

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right), \mathsf{sin.f64}\left(ky\right)\right)\right) \]
                                            4. Applied egg-rr99.7%

                                              \[\leadsto \color{blue}{\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{\sin ky}}} \]
                                            5. Taylor expanded in ky around 0

                                              \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\color{blue}{\sin kx}, \mathsf{sin.f64}\left(ky\right)\right)\right) \]
                                            6. Step-by-step derivation
                                              1. sin-lowering-sin.f6433.8%

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(\color{blue}{ky}\right)\right)\right) \]
                                            7. Simplified33.8%

                                              \[\leadsto \frac{\sin th}{\frac{\color{blue}{\sin kx}}{\sin ky}} \]
                                            8. Taylor expanded in ky around 0

                                              \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \color{blue}{\left(\frac{\sin kx + \frac{1}{6} \cdot \left({ky}^{2} \cdot \sin kx\right)}{ky}\right)}\right) \]
                                            9. Step-by-step derivation
                                              1. *-commutativeN/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \left(\frac{\sin kx + \left({ky}^{2} \cdot \sin kx\right) \cdot \frac{1}{6}}{ky}\right)\right) \]
                                              2. associate-*r*N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \left(\frac{\sin kx + {ky}^{2} \cdot \left(\sin kx \cdot \frac{1}{6}\right)}{ky}\right)\right) \]
                                              3. *-commutativeN/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \left(\frac{\sin kx + {ky}^{2} \cdot \left(\frac{1}{6} \cdot \sin kx\right)}{ky}\right)\right) \]
                                              4. /-lowering-/.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sin kx + {ky}^{2} \cdot \left(\frac{1}{6} \cdot \sin kx\right)\right), \color{blue}{ky}\right)\right) \]
                                              5. *-commutativeN/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sin kx + {ky}^{2} \cdot \left(\sin kx \cdot \frac{1}{6}\right)\right), ky\right)\right) \]
                                              6. associate-*r*N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sin kx + \left({ky}^{2} \cdot \sin kx\right) \cdot \frac{1}{6}\right), ky\right)\right) \]
                                              7. *-commutativeN/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sin kx + \frac{1}{6} \cdot \left({ky}^{2} \cdot \sin kx\right)\right), ky\right)\right) \]
                                              8. associate-*r*N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sin kx + \left(\frac{1}{6} \cdot {ky}^{2}\right) \cdot \sin kx\right), ky\right)\right) \]
                                              9. distribute-rgt1-inN/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\left(\frac{1}{6} \cdot {ky}^{2} + 1\right) \cdot \sin kx\right), ky\right)\right) \]
                                              10. *-lowering-*.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(\frac{1}{6} \cdot {ky}^{2} + 1\right), \sin kx\right), ky\right)\right) \]
                                              11. +-lowering-+.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\left(\frac{1}{6} \cdot {ky}^{2}\right), 1\right), \sin kx\right), ky\right)\right) \]
                                              12. *-lowering-*.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{1}{6}, \left({ky}^{2}\right)\right), 1\right), \sin kx\right), ky\right)\right) \]
                                              13. unpow2N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{1}{6}, \left(ky \cdot ky\right)\right), 1\right), \sin kx\right), ky\right)\right) \]
                                              14. *-lowering-*.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{1}{6}, \mathsf{*.f64}\left(ky, ky\right)\right), 1\right), \sin kx\right), ky\right)\right) \]
                                              15. sin-lowering-sin.f6433.1%

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{1}{6}, \mathsf{*.f64}\left(ky, ky\right)\right), 1\right), \mathsf{sin.f64}\left(kx\right)\right), ky\right)\right) \]
                                            10. Simplified33.1%

                                              \[\leadsto \frac{\sin th}{\color{blue}{\frac{\left(0.16666666666666666 \cdot \left(ky \cdot ky\right) + 1\right) \cdot \sin kx}{ky}}} \]

                                            if 9.99999999999999943e-30 < (sin.f64 ky)

                                            1. Initial program 99.6%

                                              \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
                                            2. Add Preprocessing
                                            3. Taylor expanded in kx around 0

                                              \[\leadsto \color{blue}{\sin th} \]
                                            4. Step-by-step derivation
                                              1. sin-lowering-sin.f6448.4%

                                                \[\leadsto \mathsf{sin.f64}\left(th\right) \]
                                            5. Simplified48.4%

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

                                            \[\leadsto \begin{array}{l} \mathbf{if}\;\sin ky \leq 10^{-29}:\\ \;\;\;\;\frac{\sin th}{\frac{\sin kx \cdot \left(1 + 0.16666666666666666 \cdot \left(ky \cdot ky\right)\right)}{ky}}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
                                          5. Add Preprocessing

                                          Alternative 15: 33.6% accurate, 2.3× speedup?

                                          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\sin ky \leq 4 \cdot 10^{-88}:\\ \;\;\;\;\sin th \cdot \frac{\sin ky}{kx}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \end{array} \]
                                          (FPCore (kx ky th)
                                           :precision binary64
                                           (if (<= (sin ky) 4e-88) (* (sin th) (/ (sin ky) kx)) (sin th)))
                                          double code(double kx, double ky, double th) {
                                          	double tmp;
                                          	if (sin(ky) <= 4e-88) {
                                          		tmp = sin(th) * (sin(ky) / kx);
                                          	} else {
                                          		tmp = sin(th);
                                          	}
                                          	return tmp;
                                          }
                                          
                                          real(8) function code(kx, ky, th)
                                              real(8), intent (in) :: kx
                                              real(8), intent (in) :: ky
                                              real(8), intent (in) :: th
                                              real(8) :: tmp
                                              if (sin(ky) <= 4d-88) then
                                                  tmp = sin(th) * (sin(ky) / kx)
                                              else
                                                  tmp = sin(th)
                                              end if
                                              code = tmp
                                          end function
                                          
                                          public static double code(double kx, double ky, double th) {
                                          	double tmp;
                                          	if (Math.sin(ky) <= 4e-88) {
                                          		tmp = Math.sin(th) * (Math.sin(ky) / kx);
                                          	} else {
                                          		tmp = Math.sin(th);
                                          	}
                                          	return tmp;
                                          }
                                          
                                          def code(kx, ky, th):
                                          	tmp = 0
                                          	if math.sin(ky) <= 4e-88:
                                          		tmp = math.sin(th) * (math.sin(ky) / kx)
                                          	else:
                                          		tmp = math.sin(th)
                                          	return tmp
                                          
                                          function code(kx, ky, th)
                                          	tmp = 0.0
                                          	if (sin(ky) <= 4e-88)
                                          		tmp = Float64(sin(th) * Float64(sin(ky) / kx));
                                          	else
                                          		tmp = sin(th);
                                          	end
                                          	return tmp
                                          end
                                          
                                          function tmp_2 = code(kx, ky, th)
                                          	tmp = 0.0;
                                          	if (sin(ky) <= 4e-88)
                                          		tmp = sin(th) * (sin(ky) / kx);
                                          	else
                                          		tmp = sin(th);
                                          	end
                                          	tmp_2 = tmp;
                                          end
                                          
                                          code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 4e-88], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
                                          
                                          \begin{array}{l}
                                          
                                          \\
                                          \begin{array}{l}
                                          \mathbf{if}\;\sin ky \leq 4 \cdot 10^{-88}:\\
                                          \;\;\;\;\sin th \cdot \frac{\sin ky}{kx}\\
                                          
                                          \mathbf{else}:\\
                                          \;\;\;\;\sin th\\
                                          
                                          
                                          \end{array}
                                          \end{array}
                                          
                                          Derivation
                                          1. Split input into 2 regimes
                                          2. if (sin.f64 ky) < 3.99999999999999974e-88

                                            1. Initial program 86.9%

                                              \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
                                            2. Add Preprocessing
                                            3. Step-by-step derivation
                                              1. *-commutativeN/A

                                                \[\leadsto \sin th \cdot \color{blue}{\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
                                              2. clear-numN/A

                                                \[\leadsto \sin th \cdot \frac{1}{\color{blue}{\frac{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}{\sin ky}}} \]
                                              3. un-div-invN/A

                                                \[\leadsto \frac{\sin th}{\color{blue}{\frac{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}{\sin ky}}} \]
                                              4. /-lowering-/.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\sin th, \color{blue}{\left(\frac{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}{\sin ky}\right)}\right) \]
                                              5. sin-lowering-sin.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \left(\frac{\color{blue}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}}{\sin ky}\right)\right) \]
                                              6. /-lowering-/.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right), \color{blue}{\sin ky}\right)\right) \]
                                              7. unpow2N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sqrt{\sin kx \cdot \sin kx + {\sin ky}^{2}}\right), \sin ky\right)\right) \]
                                              8. unpow2N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sqrt{\sin kx \cdot \sin kx + \sin ky \cdot \sin ky}\right), \sin ky\right)\right) \]
                                              9. accelerator-lowering-hypot.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\sin kx, \sin ky\right), \sin \color{blue}{ky}\right)\right) \]
                                              10. sin-lowering-sin.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \sin ky\right), \sin ky\right)\right) \]
                                              11. sin-lowering-sin.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right), \sin ky\right)\right) \]
                                              12. sin-lowering-sin.f6499.7%

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right), \mathsf{sin.f64}\left(ky\right)\right)\right) \]
                                            4. Applied egg-rr99.7%

                                              \[\leadsto \color{blue}{\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{\sin ky}}} \]
                                            5. Taylor expanded in ky around 0

                                              \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\color{blue}{\sin kx}, \mathsf{sin.f64}\left(ky\right)\right)\right) \]
                                            6. Step-by-step derivation
                                              1. sin-lowering-sin.f6434.0%

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(\color{blue}{ky}\right)\right)\right) \]
                                            7. Simplified34.0%

                                              \[\leadsto \frac{\sin th}{\frac{\color{blue}{\sin kx}}{\sin ky}} \]
                                            8. Taylor expanded in kx around 0

                                              \[\leadsto \color{blue}{\frac{\frac{1}{6} \cdot \left({kx}^{2} \cdot \left(\sin ky \cdot \sin th\right)\right) + \sin ky \cdot \sin th}{kx}} \]
                                            9. Step-by-step derivation
                                              1. /-lowering-/.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\left(\frac{1}{6} \cdot \left({kx}^{2} \cdot \left(\sin ky \cdot \sin th\right)\right) + \sin ky \cdot \sin th\right), \color{blue}{kx}\right) \]
                                              2. associate-*r*N/A

                                                \[\leadsto \mathsf{/.f64}\left(\left(\left(\frac{1}{6} \cdot {kx}^{2}\right) \cdot \left(\sin ky \cdot \sin th\right) + \sin ky \cdot \sin th\right), kx\right) \]
                                              3. distribute-lft1-inN/A

                                                \[\leadsto \mathsf{/.f64}\left(\left(\left(\frac{1}{6} \cdot {kx}^{2} + 1\right) \cdot \left(\sin ky \cdot \sin th\right)\right), kx\right) \]
                                              4. *-lowering-*.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(\frac{1}{6} \cdot {kx}^{2} + 1\right), \left(\sin ky \cdot \sin th\right)\right), kx\right) \]
                                              5. +-lowering-+.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\left(\frac{1}{6} \cdot {kx}^{2}\right), 1\right), \left(\sin ky \cdot \sin th\right)\right), kx\right) \]
                                              6. *-lowering-*.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{1}{6}, \left({kx}^{2}\right)\right), 1\right), \left(\sin ky \cdot \sin th\right)\right), kx\right) \]
                                              7. unpow2N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{1}{6}, \left(kx \cdot kx\right)\right), 1\right), \left(\sin ky \cdot \sin th\right)\right), kx\right) \]
                                              8. *-lowering-*.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{1}{6}, \mathsf{*.f64}\left(kx, kx\right)\right), 1\right), \left(\sin ky \cdot \sin th\right)\right), kx\right) \]
                                              9. *-lowering-*.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{1}{6}, \mathsf{*.f64}\left(kx, kx\right)\right), 1\right), \mathsf{*.f64}\left(\sin ky, \sin th\right)\right), kx\right) \]
                                              10. sin-lowering-sin.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{1}{6}, \mathsf{*.f64}\left(kx, kx\right)\right), 1\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(ky\right), \sin th\right)\right), kx\right) \]
                                              11. sin-lowering-sin.f6416.9%

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{1}{6}, \mathsf{*.f64}\left(kx, kx\right)\right), 1\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{sin.f64}\left(th\right)\right)\right), kx\right) \]
                                            10. Simplified16.9%

                                              \[\leadsto \color{blue}{\frac{\left(0.16666666666666666 \cdot \left(kx \cdot kx\right) + 1\right) \cdot \left(\sin ky \cdot \sin th\right)}{kx}} \]
                                            11. Taylor expanded in kx around 0

                                              \[\leadsto \color{blue}{\frac{\sin ky \cdot \sin th}{kx}} \]
                                            12. Step-by-step derivation
                                              1. *-commutativeN/A

                                                \[\leadsto \frac{\sin th \cdot \sin ky}{kx} \]
                                              2. associate-/l*N/A

                                                \[\leadsto \sin th \cdot \color{blue}{\frac{\sin ky}{kx}} \]
                                              3. *-lowering-*.f64N/A

                                                \[\leadsto \mathsf{*.f64}\left(\sin th, \color{blue}{\left(\frac{\sin ky}{kx}\right)}\right) \]
                                              4. sin-lowering-sin.f64N/A

                                                \[\leadsto \mathsf{*.f64}\left(\mathsf{sin.f64}\left(th\right), \left(\frac{\color{blue}{\sin ky}}{kx}\right)\right) \]
                                              5. /-lowering-/.f64N/A

                                                \[\leadsto \mathsf{*.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\sin ky, \color{blue}{kx}\right)\right) \]
                                              6. sin-lowering-sin.f6424.0%

                                                \[\leadsto \mathsf{*.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{sin.f64}\left(ky\right), kx\right)\right) \]
                                            13. Simplified24.0%

                                              \[\leadsto \color{blue}{\sin th \cdot \frac{\sin ky}{kx}} \]

                                            if 3.99999999999999974e-88 < (sin.f64 ky)

                                            1. Initial program 99.6%

                                              \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
                                            2. Add Preprocessing
                                            3. Taylor expanded in kx around 0

                                              \[\leadsto \color{blue}{\sin th} \]
                                            4. Step-by-step derivation
                                              1. sin-lowering-sin.f6445.3%

                                                \[\leadsto \mathsf{sin.f64}\left(th\right) \]
                                            5. Simplified45.3%

                                              \[\leadsto \color{blue}{\sin th} \]
                                          3. Recombined 2 regimes into one program.
                                          4. Add Preprocessing

                                          Alternative 16: 33.6% accurate, 2.3× speedup?

                                          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\sin ky \leq 4 \cdot 10^{-88}:\\ \;\;\;\;\sin ky \cdot \frac{\sin th}{kx}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \end{array} \]
                                          (FPCore (kx ky th)
                                           :precision binary64
                                           (if (<= (sin ky) 4e-88) (* (sin ky) (/ (sin th) kx)) (sin th)))
                                          double code(double kx, double ky, double th) {
                                          	double tmp;
                                          	if (sin(ky) <= 4e-88) {
                                          		tmp = sin(ky) * (sin(th) / kx);
                                          	} else {
                                          		tmp = sin(th);
                                          	}
                                          	return tmp;
                                          }
                                          
                                          real(8) function code(kx, ky, th)
                                              real(8), intent (in) :: kx
                                              real(8), intent (in) :: ky
                                              real(8), intent (in) :: th
                                              real(8) :: tmp
                                              if (sin(ky) <= 4d-88) then
                                                  tmp = sin(ky) * (sin(th) / kx)
                                              else
                                                  tmp = sin(th)
                                              end if
                                              code = tmp
                                          end function
                                          
                                          public static double code(double kx, double ky, double th) {
                                          	double tmp;
                                          	if (Math.sin(ky) <= 4e-88) {
                                          		tmp = Math.sin(ky) * (Math.sin(th) / kx);
                                          	} else {
                                          		tmp = Math.sin(th);
                                          	}
                                          	return tmp;
                                          }
                                          
                                          def code(kx, ky, th):
                                          	tmp = 0
                                          	if math.sin(ky) <= 4e-88:
                                          		tmp = math.sin(ky) * (math.sin(th) / kx)
                                          	else:
                                          		tmp = math.sin(th)
                                          	return tmp
                                          
                                          function code(kx, ky, th)
                                          	tmp = 0.0
                                          	if (sin(ky) <= 4e-88)
                                          		tmp = Float64(sin(ky) * Float64(sin(th) / kx));
                                          	else
                                          		tmp = sin(th);
                                          	end
                                          	return tmp
                                          end
                                          
                                          function tmp_2 = code(kx, ky, th)
                                          	tmp = 0.0;
                                          	if (sin(ky) <= 4e-88)
                                          		tmp = sin(ky) * (sin(th) / kx);
                                          	else
                                          		tmp = sin(th);
                                          	end
                                          	tmp_2 = tmp;
                                          end
                                          
                                          code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 4e-88], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
                                          
                                          \begin{array}{l}
                                          
                                          \\
                                          \begin{array}{l}
                                          \mathbf{if}\;\sin ky \leq 4 \cdot 10^{-88}:\\
                                          \;\;\;\;\sin ky \cdot \frac{\sin th}{kx}\\
                                          
                                          \mathbf{else}:\\
                                          \;\;\;\;\sin th\\
                                          
                                          
                                          \end{array}
                                          \end{array}
                                          
                                          Derivation
                                          1. Split input into 2 regimes
                                          2. if (sin.f64 ky) < 3.99999999999999974e-88

                                            1. Initial program 86.9%

                                              \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
                                            2. Add Preprocessing
                                            3. Step-by-step derivation
                                              1. *-commutativeN/A

                                                \[\leadsto \sin th \cdot \color{blue}{\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
                                              2. clear-numN/A

                                                \[\leadsto \sin th \cdot \frac{1}{\color{blue}{\frac{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}{\sin ky}}} \]
                                              3. un-div-invN/A

                                                \[\leadsto \frac{\sin th}{\color{blue}{\frac{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}{\sin ky}}} \]
                                              4. /-lowering-/.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\sin th, \color{blue}{\left(\frac{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}{\sin ky}\right)}\right) \]
                                              5. sin-lowering-sin.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \left(\frac{\color{blue}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}}{\sin ky}\right)\right) \]
                                              6. /-lowering-/.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right), \color{blue}{\sin ky}\right)\right) \]
                                              7. unpow2N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sqrt{\sin kx \cdot \sin kx + {\sin ky}^{2}}\right), \sin ky\right)\right) \]
                                              8. unpow2N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sqrt{\sin kx \cdot \sin kx + \sin ky \cdot \sin ky}\right), \sin ky\right)\right) \]
                                              9. accelerator-lowering-hypot.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\sin kx, \sin ky\right), \sin \color{blue}{ky}\right)\right) \]
                                              10. sin-lowering-sin.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \sin ky\right), \sin ky\right)\right) \]
                                              11. sin-lowering-sin.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right), \sin ky\right)\right) \]
                                              12. sin-lowering-sin.f6499.7%

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right), \mathsf{sin.f64}\left(ky\right)\right)\right) \]
                                            4. Applied egg-rr99.7%

                                              \[\leadsto \color{blue}{\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{\sin ky}}} \]
                                            5. Taylor expanded in ky around 0

                                              \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\color{blue}{\sin kx}, \mathsf{sin.f64}\left(ky\right)\right)\right) \]
                                            6. Step-by-step derivation
                                              1. sin-lowering-sin.f6434.0%

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(\color{blue}{ky}\right)\right)\right) \]
                                            7. Simplified34.0%

                                              \[\leadsto \frac{\sin th}{\frac{\color{blue}{\sin kx}}{\sin ky}} \]
                                            8. Taylor expanded in kx around 0

                                              \[\leadsto \color{blue}{\frac{\sin ky \cdot \sin th}{kx}} \]
                                            9. Step-by-step derivation
                                              1. associate-/l*N/A

                                                \[\leadsto \sin ky \cdot \color{blue}{\frac{\sin th}{kx}} \]
                                              2. *-lowering-*.f64N/A

                                                \[\leadsto \mathsf{*.f64}\left(\sin ky, \color{blue}{\left(\frac{\sin th}{kx}\right)}\right) \]
                                              3. sin-lowering-sin.f64N/A

                                                \[\leadsto \mathsf{*.f64}\left(\mathsf{sin.f64}\left(ky\right), \left(\frac{\color{blue}{\sin th}}{kx}\right)\right) \]
                                              4. /-lowering-/.f64N/A

                                                \[\leadsto \mathsf{*.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{/.f64}\left(\sin th, \color{blue}{kx}\right)\right) \]
                                              5. sin-lowering-sin.f6424.0%

                                                \[\leadsto \mathsf{*.f64}\left(\mathsf{sin.f64}\left(ky\right), \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), kx\right)\right) \]
                                            10. Simplified24.0%

                                              \[\leadsto \color{blue}{\sin ky \cdot \frac{\sin th}{kx}} \]

                                            if 3.99999999999999974e-88 < (sin.f64 ky)

                                            1. Initial program 99.6%

                                              \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
                                            2. Add Preprocessing
                                            3. Taylor expanded in kx around 0

                                              \[\leadsto \color{blue}{\sin th} \]
                                            4. Step-by-step derivation
                                              1. sin-lowering-sin.f6445.3%

                                                \[\leadsto \mathsf{sin.f64}\left(th\right) \]
                                            5. Simplified45.3%

                                              \[\leadsto \color{blue}{\sin th} \]
                                          3. Recombined 2 regimes into one program.
                                          4. Add Preprocessing

                                          Alternative 17: 33.4% accurate, 3.3× speedup?

                                          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\sin ky \leq 4 \cdot 10^{-88}:\\ \;\;\;\;\sin th \cdot \frac{ky}{kx \cdot \left(1 + -0.16666666666666666 \cdot \left(kx \cdot kx\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \end{array} \]
                                          (FPCore (kx ky th)
                                           :precision binary64
                                           (if (<= (sin ky) 4e-88)
                                             (* (sin th) (/ ky (* kx (+ 1.0 (* -0.16666666666666666 (* kx kx))))))
                                             (sin th)))
                                          double code(double kx, double ky, double th) {
                                          	double tmp;
                                          	if (sin(ky) <= 4e-88) {
                                          		tmp = sin(th) * (ky / (kx * (1.0 + (-0.16666666666666666 * (kx * kx)))));
                                          	} else {
                                          		tmp = sin(th);
                                          	}
                                          	return tmp;
                                          }
                                          
                                          real(8) function code(kx, ky, th)
                                              real(8), intent (in) :: kx
                                              real(8), intent (in) :: ky
                                              real(8), intent (in) :: th
                                              real(8) :: tmp
                                              if (sin(ky) <= 4d-88) then
                                                  tmp = sin(th) * (ky / (kx * (1.0d0 + ((-0.16666666666666666d0) * (kx * kx)))))
                                              else
                                                  tmp = sin(th)
                                              end if
                                              code = tmp
                                          end function
                                          
                                          public static double code(double kx, double ky, double th) {
                                          	double tmp;
                                          	if (Math.sin(ky) <= 4e-88) {
                                          		tmp = Math.sin(th) * (ky / (kx * (1.0 + (-0.16666666666666666 * (kx * kx)))));
                                          	} else {
                                          		tmp = Math.sin(th);
                                          	}
                                          	return tmp;
                                          }
                                          
                                          def code(kx, ky, th):
                                          	tmp = 0
                                          	if math.sin(ky) <= 4e-88:
                                          		tmp = math.sin(th) * (ky / (kx * (1.0 + (-0.16666666666666666 * (kx * kx)))))
                                          	else:
                                          		tmp = math.sin(th)
                                          	return tmp
                                          
                                          function code(kx, ky, th)
                                          	tmp = 0.0
                                          	if (sin(ky) <= 4e-88)
                                          		tmp = Float64(sin(th) * Float64(ky / Float64(kx * Float64(1.0 + Float64(-0.16666666666666666 * Float64(kx * kx))))));
                                          	else
                                          		tmp = sin(th);
                                          	end
                                          	return tmp
                                          end
                                          
                                          function tmp_2 = code(kx, ky, th)
                                          	tmp = 0.0;
                                          	if (sin(ky) <= 4e-88)
                                          		tmp = sin(th) * (ky / (kx * (1.0 + (-0.16666666666666666 * (kx * kx)))));
                                          	else
                                          		tmp = sin(th);
                                          	end
                                          	tmp_2 = tmp;
                                          end
                                          
                                          code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 4e-88], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[(kx * N[(1.0 + N[(-0.16666666666666666 * N[(kx * kx), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
                                          
                                          \begin{array}{l}
                                          
                                          \\
                                          \begin{array}{l}
                                          \mathbf{if}\;\sin ky \leq 4 \cdot 10^{-88}:\\
                                          \;\;\;\;\sin th \cdot \frac{ky}{kx \cdot \left(1 + -0.16666666666666666 \cdot \left(kx \cdot kx\right)\right)}\\
                                          
                                          \mathbf{else}:\\
                                          \;\;\;\;\sin th\\
                                          
                                          
                                          \end{array}
                                          \end{array}
                                          
                                          Derivation
                                          1. Split input into 2 regimes
                                          2. if (sin.f64 ky) < 3.99999999999999974e-88

                                            1. Initial program 86.9%

                                              \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
                                            2. Add Preprocessing
                                            3. Taylor expanded in ky around 0

                                              \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(\frac{ky}{\sin kx}\right)}, \mathsf{sin.f64}\left(th\right)\right) \]
                                            4. Step-by-step derivation
                                              1. /-lowering-/.f64N/A

                                                \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(ky, \sin kx\right), \mathsf{sin.f64}\left(\color{blue}{th}\right)\right) \]
                                              2. sin-lowering-sin.f6432.7%

                                                \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(ky, \mathsf{sin.f64}\left(kx\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                                            5. Simplified32.7%

                                              \[\leadsto \color{blue}{\frac{ky}{\sin kx}} \cdot \sin th \]
                                            6. Taylor expanded in kx around 0

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

                                                \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(ky, \mathsf{*.f64}\left(kx, \left(1 + \frac{-1}{6} \cdot {kx}^{2}\right)\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                                              2. +-lowering-+.f64N/A

                                                \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(ky, \mathsf{*.f64}\left(kx, \mathsf{+.f64}\left(1, \left(\frac{-1}{6} \cdot {kx}^{2}\right)\right)\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                                              3. *-lowering-*.f64N/A

                                                \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(ky, \mathsf{*.f64}\left(kx, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{6}, \left({kx}^{2}\right)\right)\right)\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                                              4. unpow2N/A

                                                \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(ky, \mathsf{*.f64}\left(kx, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{6}, \left(kx \cdot kx\right)\right)\right)\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                                              5. *-lowering-*.f6423.9%

                                                \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(ky, \mathsf{*.f64}\left(kx, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(kx, kx\right)\right)\right)\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                                            8. Simplified23.9%

                                              \[\leadsto \frac{ky}{\color{blue}{kx \cdot \left(1 + -0.16666666666666666 \cdot \left(kx \cdot kx\right)\right)}} \cdot \sin th \]

                                            if 3.99999999999999974e-88 < (sin.f64 ky)

                                            1. Initial program 99.6%

                                              \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
                                            2. Add Preprocessing
                                            3. Taylor expanded in kx around 0

                                              \[\leadsto \color{blue}{\sin th} \]
                                            4. Step-by-step derivation
                                              1. sin-lowering-sin.f6445.3%

                                                \[\leadsto \mathsf{sin.f64}\left(th\right) \]
                                            5. Simplified45.3%

                                              \[\leadsto \color{blue}{\sin th} \]
                                          3. Recombined 2 regimes into one program.
                                          4. Final simplification30.4%

                                            \[\leadsto \begin{array}{l} \mathbf{if}\;\sin ky \leq 4 \cdot 10^{-88}:\\ \;\;\;\;\sin th \cdot \frac{ky}{kx \cdot \left(1 + -0.16666666666666666 \cdot \left(kx \cdot kx\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
                                          5. Add Preprocessing

                                          Alternative 18: 32.7% accurate, 3.4× speedup?

                                          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;ky \leq 1.4 \cdot 10^{-29}:\\ \;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \end{array} \]
                                          (FPCore (kx ky th)
                                           :precision binary64
                                           (if (<= ky 1.4e-29) (/ (sin th) (/ (sin kx) ky)) (sin th)))
                                          double code(double kx, double ky, double th) {
                                          	double tmp;
                                          	if (ky <= 1.4e-29) {
                                          		tmp = sin(th) / (sin(kx) / ky);
                                          	} else {
                                          		tmp = sin(th);
                                          	}
                                          	return tmp;
                                          }
                                          
                                          real(8) function code(kx, ky, th)
                                              real(8), intent (in) :: kx
                                              real(8), intent (in) :: ky
                                              real(8), intent (in) :: th
                                              real(8) :: tmp
                                              if (ky <= 1.4d-29) then
                                                  tmp = sin(th) / (sin(kx) / ky)
                                              else
                                                  tmp = sin(th)
                                              end if
                                              code = tmp
                                          end function
                                          
                                          public static double code(double kx, double ky, double th) {
                                          	double tmp;
                                          	if (ky <= 1.4e-29) {
                                          		tmp = Math.sin(th) / (Math.sin(kx) / ky);
                                          	} else {
                                          		tmp = Math.sin(th);
                                          	}
                                          	return tmp;
                                          }
                                          
                                          def code(kx, ky, th):
                                          	tmp = 0
                                          	if ky <= 1.4e-29:
                                          		tmp = math.sin(th) / (math.sin(kx) / ky)
                                          	else:
                                          		tmp = math.sin(th)
                                          	return tmp
                                          
                                          function code(kx, ky, th)
                                          	tmp = 0.0
                                          	if (ky <= 1.4e-29)
                                          		tmp = Float64(sin(th) / Float64(sin(kx) / ky));
                                          	else
                                          		tmp = sin(th);
                                          	end
                                          	return tmp
                                          end
                                          
                                          function tmp_2 = code(kx, ky, th)
                                          	tmp = 0.0;
                                          	if (ky <= 1.4e-29)
                                          		tmp = sin(th) / (sin(kx) / ky);
                                          	else
                                          		tmp = sin(th);
                                          	end
                                          	tmp_2 = tmp;
                                          end
                                          
                                          code[kx_, ky_, th_] := If[LessEqual[ky, 1.4e-29], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
                                          
                                          \begin{array}{l}
                                          
                                          \\
                                          \begin{array}{l}
                                          \mathbf{if}\;ky \leq 1.4 \cdot 10^{-29}:\\
                                          \;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\
                                          
                                          \mathbf{else}:\\
                                          \;\;\;\;\sin th\\
                                          
                                          
                                          \end{array}
                                          \end{array}
                                          
                                          Derivation
                                          1. Split input into 2 regimes
                                          2. if ky < 1.4000000000000001e-29

                                            1. Initial program 88.0%

                                              \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
                                            2. Add Preprocessing
                                            3. Step-by-step derivation
                                              1. *-commutativeN/A

                                                \[\leadsto \sin th \cdot \color{blue}{\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}} \]
                                              2. clear-numN/A

                                                \[\leadsto \sin th \cdot \frac{1}{\color{blue}{\frac{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}{\sin ky}}} \]
                                              3. un-div-invN/A

                                                \[\leadsto \frac{\sin th}{\color{blue}{\frac{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}{\sin ky}}} \]
                                              4. /-lowering-/.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\sin th, \color{blue}{\left(\frac{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}{\sin ky}\right)}\right) \]
                                              5. sin-lowering-sin.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \left(\frac{\color{blue}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}}{\sin ky}\right)\right) \]
                                              6. /-lowering-/.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right), \color{blue}{\sin ky}\right)\right) \]
                                              7. unpow2N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sqrt{\sin kx \cdot \sin kx + {\sin ky}^{2}}\right), \sin ky\right)\right) \]
                                              8. unpow2N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\left(\sqrt{\sin kx \cdot \sin kx + \sin ky \cdot \sin ky}\right), \sin ky\right)\right) \]
                                              9. accelerator-lowering-hypot.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\sin kx, \sin ky\right), \sin \color{blue}{ky}\right)\right) \]
                                              10. sin-lowering-sin.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \sin ky\right), \sin ky\right)\right) \]
                                              11. sin-lowering-sin.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right), \sin ky\right)\right) \]
                                              12. sin-lowering-sin.f6499.6%

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{hypot.f64}\left(\mathsf{sin.f64}\left(kx\right), \mathsf{sin.f64}\left(ky\right)\right), \mathsf{sin.f64}\left(ky\right)\right)\right) \]
                                            4. Applied egg-rr99.6%

                                              \[\leadsto \color{blue}{\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{\sin ky}}} \]
                                            5. Taylor expanded in ky around 0

                                              \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \color{blue}{\left(\frac{\sin kx}{ky}\right)}\right) \]
                                            6. Step-by-step derivation
                                              1. /-lowering-/.f64N/A

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\sin kx, \color{blue}{ky}\right)\right) \]
                                              2. sin-lowering-sin.f6431.7%

                                                \[\leadsto \mathsf{/.f64}\left(\mathsf{sin.f64}\left(th\right), \mathsf{/.f64}\left(\mathsf{sin.f64}\left(kx\right), ky\right)\right) \]
                                            7. Simplified31.7%

                                              \[\leadsto \frac{\sin th}{\color{blue}{\frac{\sin kx}{ky}}} \]

                                            if 1.4000000000000001e-29 < ky

                                            1. Initial program 99.8%

                                              \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
                                            2. Add Preprocessing
                                            3. Taylor expanded in kx around 0

                                              \[\leadsto \color{blue}{\sin th} \]
                                            4. Step-by-step derivation
                                              1. sin-lowering-sin.f6435.6%

                                                \[\leadsto \mathsf{sin.f64}\left(th\right) \]
                                            5. Simplified35.6%

                                              \[\leadsto \color{blue}{\sin th} \]
                                          3. Recombined 2 regimes into one program.
                                          4. Add Preprocessing

                                          Alternative 19: 32.7% accurate, 3.4× speedup?

                                          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;ky \leq 10^{-29}:\\ \;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \end{array} \]
                                          (FPCore (kx ky th)
                                           :precision binary64
                                           (if (<= ky 1e-29) (* (sin th) (/ ky (sin kx))) (sin th)))
                                          double code(double kx, double ky, double th) {
                                          	double tmp;
                                          	if (ky <= 1e-29) {
                                          		tmp = sin(th) * (ky / sin(kx));
                                          	} else {
                                          		tmp = sin(th);
                                          	}
                                          	return tmp;
                                          }
                                          
                                          real(8) function code(kx, ky, th)
                                              real(8), intent (in) :: kx
                                              real(8), intent (in) :: ky
                                              real(8), intent (in) :: th
                                              real(8) :: tmp
                                              if (ky <= 1d-29) then
                                                  tmp = sin(th) * (ky / sin(kx))
                                              else
                                                  tmp = sin(th)
                                              end if
                                              code = tmp
                                          end function
                                          
                                          public static double code(double kx, double ky, double th) {
                                          	double tmp;
                                          	if (ky <= 1e-29) {
                                          		tmp = Math.sin(th) * (ky / Math.sin(kx));
                                          	} else {
                                          		tmp = Math.sin(th);
                                          	}
                                          	return tmp;
                                          }
                                          
                                          def code(kx, ky, th):
                                          	tmp = 0
                                          	if ky <= 1e-29:
                                          		tmp = math.sin(th) * (ky / math.sin(kx))
                                          	else:
                                          		tmp = math.sin(th)
                                          	return tmp
                                          
                                          function code(kx, ky, th)
                                          	tmp = 0.0
                                          	if (ky <= 1e-29)
                                          		tmp = Float64(sin(th) * Float64(ky / sin(kx)));
                                          	else
                                          		tmp = sin(th);
                                          	end
                                          	return tmp
                                          end
                                          
                                          function tmp_2 = code(kx, ky, th)
                                          	tmp = 0.0;
                                          	if (ky <= 1e-29)
                                          		tmp = sin(th) * (ky / sin(kx));
                                          	else
                                          		tmp = sin(th);
                                          	end
                                          	tmp_2 = tmp;
                                          end
                                          
                                          code[kx_, ky_, th_] := If[LessEqual[ky, 1e-29], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
                                          
                                          \begin{array}{l}
                                          
                                          \\
                                          \begin{array}{l}
                                          \mathbf{if}\;ky \leq 10^{-29}:\\
                                          \;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
                                          
                                          \mathbf{else}:\\
                                          \;\;\;\;\sin th\\
                                          
                                          
                                          \end{array}
                                          \end{array}
                                          
                                          Derivation
                                          1. Split input into 2 regimes
                                          2. if ky < 9.99999999999999943e-30

                                            1. Initial program 88.0%

                                              \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
                                            2. Add Preprocessing
                                            3. Taylor expanded in ky around 0

                                              \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(\frac{ky}{\sin kx}\right)}, \mathsf{sin.f64}\left(th\right)\right) \]
                                            4. Step-by-step derivation
                                              1. /-lowering-/.f64N/A

                                                \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(ky, \sin kx\right), \mathsf{sin.f64}\left(\color{blue}{th}\right)\right) \]
                                              2. sin-lowering-sin.f6431.7%

                                                \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(ky, \mathsf{sin.f64}\left(kx\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                                            5. Simplified31.7%

                                              \[\leadsto \color{blue}{\frac{ky}{\sin kx}} \cdot \sin th \]

                                            if 9.99999999999999943e-30 < ky

                                            1. Initial program 99.8%

                                              \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
                                            2. Add Preprocessing
                                            3. Taylor expanded in kx around 0

                                              \[\leadsto \color{blue}{\sin th} \]
                                            4. Step-by-step derivation
                                              1. sin-lowering-sin.f6435.6%

                                                \[\leadsto \mathsf{sin.f64}\left(th\right) \]
                                            5. Simplified35.6%

                                              \[\leadsto \color{blue}{\sin th} \]
                                          3. Recombined 2 regimes into one program.
                                          4. Final simplification32.6%

                                            \[\leadsto \begin{array}{l} \mathbf{if}\;ky \leq 10^{-29}:\\ \;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
                                          5. Add Preprocessing

                                          Alternative 20: 26.3% accurate, 6.4× speedup?

                                          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;ky \leq 2.3 \cdot 10^{-88}:\\ \;\;\;\;\sin th \cdot \frac{ky}{kx}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \end{array} \]
                                          (FPCore (kx ky th)
                                           :precision binary64
                                           (if (<= ky 2.3e-88) (* (sin th) (/ ky kx)) (sin th)))
                                          double code(double kx, double ky, double th) {
                                          	double tmp;
                                          	if (ky <= 2.3e-88) {
                                          		tmp = sin(th) * (ky / kx);
                                          	} else {
                                          		tmp = sin(th);
                                          	}
                                          	return tmp;
                                          }
                                          
                                          real(8) function code(kx, ky, th)
                                              real(8), intent (in) :: kx
                                              real(8), intent (in) :: ky
                                              real(8), intent (in) :: th
                                              real(8) :: tmp
                                              if (ky <= 2.3d-88) then
                                                  tmp = sin(th) * (ky / kx)
                                              else
                                                  tmp = sin(th)
                                              end if
                                              code = tmp
                                          end function
                                          
                                          public static double code(double kx, double ky, double th) {
                                          	double tmp;
                                          	if (ky <= 2.3e-88) {
                                          		tmp = Math.sin(th) * (ky / kx);
                                          	} else {
                                          		tmp = Math.sin(th);
                                          	}
                                          	return tmp;
                                          }
                                          
                                          def code(kx, ky, th):
                                          	tmp = 0
                                          	if ky <= 2.3e-88:
                                          		tmp = math.sin(th) * (ky / kx)
                                          	else:
                                          		tmp = math.sin(th)
                                          	return tmp
                                          
                                          function code(kx, ky, th)
                                          	tmp = 0.0
                                          	if (ky <= 2.3e-88)
                                          		tmp = Float64(sin(th) * Float64(ky / kx));
                                          	else
                                          		tmp = sin(th);
                                          	end
                                          	return tmp
                                          end
                                          
                                          function tmp_2 = code(kx, ky, th)
                                          	tmp = 0.0;
                                          	if (ky <= 2.3e-88)
                                          		tmp = sin(th) * (ky / kx);
                                          	else
                                          		tmp = sin(th);
                                          	end
                                          	tmp_2 = tmp;
                                          end
                                          
                                          code[kx_, ky_, th_] := If[LessEqual[ky, 2.3e-88], N[(N[Sin[th], $MachinePrecision] * N[(ky / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
                                          
                                          \begin{array}{l}
                                          
                                          \\
                                          \begin{array}{l}
                                          \mathbf{if}\;ky \leq 2.3 \cdot 10^{-88}:\\
                                          \;\;\;\;\sin th \cdot \frac{ky}{kx}\\
                                          
                                          \mathbf{else}:\\
                                          \;\;\;\;\sin th\\
                                          
                                          
                                          \end{array}
                                          \end{array}
                                          
                                          Derivation
                                          1. Split input into 2 regimes
                                          2. if ky < 2.29999999999999986e-88

                                            1. Initial program 87.3%

                                              \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
                                            2. Add Preprocessing
                                            3. Taylor expanded in ky around 0

                                              \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(\frac{ky}{\sin kx}\right)}, \mathsf{sin.f64}\left(th\right)\right) \]
                                            4. Step-by-step derivation
                                              1. /-lowering-/.f64N/A

                                                \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(ky, \sin kx\right), \mathsf{sin.f64}\left(\color{blue}{th}\right)\right) \]
                                              2. sin-lowering-sin.f6431.8%

                                                \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(ky, \mathsf{sin.f64}\left(kx\right)\right), \mathsf{sin.f64}\left(th\right)\right) \]
                                            5. Simplified31.8%

                                              \[\leadsto \color{blue}{\frac{ky}{\sin kx}} \cdot \sin th \]
                                            6. Taylor expanded in kx around 0

                                              \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(\frac{ky}{kx}\right)}, \mathsf{sin.f64}\left(th\right)\right) \]
                                            7. Step-by-step derivation
                                              1. /-lowering-/.f6423.2%

                                                \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(ky, kx\right), \mathsf{sin.f64}\left(\color{blue}{th}\right)\right) \]
                                            8. Simplified23.2%

                                              \[\leadsto \color{blue}{\frac{ky}{kx}} \cdot \sin th \]

                                            if 2.29999999999999986e-88 < ky

                                            1. Initial program 99.7%

                                              \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
                                            2. Add Preprocessing
                                            3. Taylor expanded in kx around 0

                                              \[\leadsto \color{blue}{\sin th} \]
                                            4. Step-by-step derivation
                                              1. sin-lowering-sin.f6434.2%

                                                \[\leadsto \mathsf{sin.f64}\left(th\right) \]
                                            5. Simplified34.2%

                                              \[\leadsto \color{blue}{\sin th} \]
                                          3. Recombined 2 regimes into one program.
                                          4. Final simplification26.3%

                                            \[\leadsto \begin{array}{l} \mathbf{if}\;ky \leq 2.3 \cdot 10^{-88}:\\ \;\;\;\;\sin th \cdot \frac{ky}{kx}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
                                          5. Add Preprocessing

                                          Alternative 21: 24.9% accurate, 6.7× speedup?

                                          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;kx \leq 1.45 \cdot 10^{+38}:\\ \;\;\;\;\sin th\\ \mathbf{else}:\\ \;\;\;\;-0.16666666666666666 \cdot \left(th \cdot \left(th \cdot th\right)\right)\\ \end{array} \end{array} \]
                                          (FPCore (kx ky th)
                                           :precision binary64
                                           (if (<= kx 1.45e+38) (sin th) (* -0.16666666666666666 (* th (* th th)))))
                                          double code(double kx, double ky, double th) {
                                          	double tmp;
                                          	if (kx <= 1.45e+38) {
                                          		tmp = sin(th);
                                          	} else {
                                          		tmp = -0.16666666666666666 * (th * (th * th));
                                          	}
                                          	return tmp;
                                          }
                                          
                                          real(8) function code(kx, ky, th)
                                              real(8), intent (in) :: kx
                                              real(8), intent (in) :: ky
                                              real(8), intent (in) :: th
                                              real(8) :: tmp
                                              if (kx <= 1.45d+38) then
                                                  tmp = sin(th)
                                              else
                                                  tmp = (-0.16666666666666666d0) * (th * (th * th))
                                              end if
                                              code = tmp
                                          end function
                                          
                                          public static double code(double kx, double ky, double th) {
                                          	double tmp;
                                          	if (kx <= 1.45e+38) {
                                          		tmp = Math.sin(th);
                                          	} else {
                                          		tmp = -0.16666666666666666 * (th * (th * th));
                                          	}
                                          	return tmp;
                                          }
                                          
                                          def code(kx, ky, th):
                                          	tmp = 0
                                          	if kx <= 1.45e+38:
                                          		tmp = math.sin(th)
                                          	else:
                                          		tmp = -0.16666666666666666 * (th * (th * th))
                                          	return tmp
                                          
                                          function code(kx, ky, th)
                                          	tmp = 0.0
                                          	if (kx <= 1.45e+38)
                                          		tmp = sin(th);
                                          	else
                                          		tmp = Float64(-0.16666666666666666 * Float64(th * Float64(th * th)));
                                          	end
                                          	return tmp
                                          end
                                          
                                          function tmp_2 = code(kx, ky, th)
                                          	tmp = 0.0;
                                          	if (kx <= 1.45e+38)
                                          		tmp = sin(th);
                                          	else
                                          		tmp = -0.16666666666666666 * (th * (th * th));
                                          	end
                                          	tmp_2 = tmp;
                                          end
                                          
                                          code[kx_, ky_, th_] := If[LessEqual[kx, 1.45e+38], N[Sin[th], $MachinePrecision], N[(-0.16666666666666666 * N[(th * N[(th * th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                                          
                                          \begin{array}{l}
                                          
                                          \\
                                          \begin{array}{l}
                                          \mathbf{if}\;kx \leq 1.45 \cdot 10^{+38}:\\
                                          \;\;\;\;\sin th\\
                                          
                                          \mathbf{else}:\\
                                          \;\;\;\;-0.16666666666666666 \cdot \left(th \cdot \left(th \cdot th\right)\right)\\
                                          
                                          
                                          \end{array}
                                          \end{array}
                                          
                                          Derivation
                                          1. Split input into 2 regimes
                                          2. if kx < 1.45000000000000003e38

                                            1. Initial program 88.4%

                                              \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
                                            2. Add Preprocessing
                                            3. Taylor expanded in kx around 0

                                              \[\leadsto \color{blue}{\sin th} \]
                                            4. Step-by-step derivation
                                              1. sin-lowering-sin.f6420.9%

                                                \[\leadsto \mathsf{sin.f64}\left(th\right) \]
                                            5. Simplified20.9%

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

                                            if 1.45000000000000003e38 < kx

                                            1. Initial program 99.2%

                                              \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
                                            2. Add Preprocessing
                                            3. Taylor expanded in kx around 0

                                              \[\leadsto \color{blue}{\sin th} \]
                                            4. Step-by-step derivation
                                              1. sin-lowering-sin.f649.2%

                                                \[\leadsto \mathsf{sin.f64}\left(th\right) \]
                                            5. Simplified9.2%

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

                                              \[\leadsto \color{blue}{th \cdot \left(1 + \frac{-1}{6} \cdot {th}^{2}\right)} \]
                                            7. Step-by-step derivation
                                              1. *-lowering-*.f64N/A

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

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

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

                                                \[\leadsto \mathsf{*.f64}\left(th, \mathsf{+.f64}\left(1, \left(\left(th \cdot th\right) \cdot \frac{-1}{6}\right)\right)\right) \]
                                              5. associate-*l*N/A

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

                                                \[\leadsto \mathsf{*.f64}\left(th, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(th, \color{blue}{\left(th \cdot \frac{-1}{6}\right)}\right)\right)\right) \]
                                              7. *-lowering-*.f646.0%

                                                \[\leadsto \mathsf{*.f64}\left(th, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(th, \mathsf{*.f64}\left(th, \color{blue}{\frac{-1}{6}}\right)\right)\right)\right) \]
                                            8. Simplified6.0%

                                              \[\leadsto \color{blue}{th \cdot \left(1 + th \cdot \left(th \cdot -0.16666666666666666\right)\right)} \]
                                            9. Taylor expanded in th around inf

                                              \[\leadsto \color{blue}{\frac{-1}{6} \cdot {th}^{3}} \]
                                            10. Step-by-step derivation
                                              1. *-lowering-*.f64N/A

                                                \[\leadsto \mathsf{*.f64}\left(\frac{-1}{6}, \color{blue}{\left({th}^{3}\right)}\right) \]
                                              2. cube-multN/A

                                                \[\leadsto \mathsf{*.f64}\left(\frac{-1}{6}, \left(th \cdot \color{blue}{\left(th \cdot th\right)}\right)\right) \]
                                              3. unpow2N/A

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

                                                \[\leadsto \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(th, \color{blue}{\left({th}^{2}\right)}\right)\right) \]
                                              5. unpow2N/A

                                                \[\leadsto \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(th, \left(th \cdot \color{blue}{th}\right)\right)\right) \]
                                              6. *-lowering-*.f649.3%

                                                \[\leadsto \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(th, \mathsf{*.f64}\left(th, \color{blue}{th}\right)\right)\right) \]
                                            11. Simplified9.3%

                                              \[\leadsto \color{blue}{-0.16666666666666666 \cdot \left(th \cdot \left(th \cdot th\right)\right)} \]
                                          3. Recombined 2 regimes into one program.
                                          4. Add Preprocessing

                                          Alternative 22: 15.9% accurate, 59.0× speedup?

                                          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;kx \leq 12000:\\ \;\;\;\;th\\ \mathbf{else}:\\ \;\;\;\;-0.16666666666666666 \cdot \left(th \cdot \left(th \cdot th\right)\right)\\ \end{array} \end{array} \]
                                          (FPCore (kx ky th)
                                           :precision binary64
                                           (if (<= kx 12000.0) th (* -0.16666666666666666 (* th (* th th)))))
                                          double code(double kx, double ky, double th) {
                                          	double tmp;
                                          	if (kx <= 12000.0) {
                                          		tmp = th;
                                          	} else {
                                          		tmp = -0.16666666666666666 * (th * (th * th));
                                          	}
                                          	return tmp;
                                          }
                                          
                                          real(8) function code(kx, ky, th)
                                              real(8), intent (in) :: kx
                                              real(8), intent (in) :: ky
                                              real(8), intent (in) :: th
                                              real(8) :: tmp
                                              if (kx <= 12000.0d0) then
                                                  tmp = th
                                              else
                                                  tmp = (-0.16666666666666666d0) * (th * (th * th))
                                              end if
                                              code = tmp
                                          end function
                                          
                                          public static double code(double kx, double ky, double th) {
                                          	double tmp;
                                          	if (kx <= 12000.0) {
                                          		tmp = th;
                                          	} else {
                                          		tmp = -0.16666666666666666 * (th * (th * th));
                                          	}
                                          	return tmp;
                                          }
                                          
                                          def code(kx, ky, th):
                                          	tmp = 0
                                          	if kx <= 12000.0:
                                          		tmp = th
                                          	else:
                                          		tmp = -0.16666666666666666 * (th * (th * th))
                                          	return tmp
                                          
                                          function code(kx, ky, th)
                                          	tmp = 0.0
                                          	if (kx <= 12000.0)
                                          		tmp = th;
                                          	else
                                          		tmp = Float64(-0.16666666666666666 * Float64(th * Float64(th * th)));
                                          	end
                                          	return tmp
                                          end
                                          
                                          function tmp_2 = code(kx, ky, th)
                                          	tmp = 0.0;
                                          	if (kx <= 12000.0)
                                          		tmp = th;
                                          	else
                                          		tmp = -0.16666666666666666 * (th * (th * th));
                                          	end
                                          	tmp_2 = tmp;
                                          end
                                          
                                          code[kx_, ky_, th_] := If[LessEqual[kx, 12000.0], th, N[(-0.16666666666666666 * N[(th * N[(th * th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                                          
                                          \begin{array}{l}
                                          
                                          \\
                                          \begin{array}{l}
                                          \mathbf{if}\;kx \leq 12000:\\
                                          \;\;\;\;th\\
                                          
                                          \mathbf{else}:\\
                                          \;\;\;\;-0.16666666666666666 \cdot \left(th \cdot \left(th \cdot th\right)\right)\\
                                          
                                          
                                          \end{array}
                                          \end{array}
                                          
                                          Derivation
                                          1. Split input into 2 regimes
                                          2. if kx < 12000

                                            1. Initial program 88.1%

                                              \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
                                            2. Add Preprocessing
                                            3. Taylor expanded in kx around 0

                                              \[\leadsto \color{blue}{\sin th} \]
                                            4. Step-by-step derivation
                                              1. sin-lowering-sin.f6421.4%

                                                \[\leadsto \mathsf{sin.f64}\left(th\right) \]
                                            5. Simplified21.4%

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

                                              \[\leadsto \color{blue}{th} \]
                                            7. Step-by-step derivation
                                              1. Simplified12.1%

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

                                              if 12000 < kx

                                              1. Initial program 99.3%

                                                \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
                                              2. Add Preprocessing
                                              3. Taylor expanded in kx around 0

                                                \[\leadsto \color{blue}{\sin th} \]
                                              4. Step-by-step derivation
                                                1. sin-lowering-sin.f648.9%

                                                  \[\leadsto \mathsf{sin.f64}\left(th\right) \]
                                              5. Simplified8.9%

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

                                                \[\leadsto \color{blue}{th \cdot \left(1 + \frac{-1}{6} \cdot {th}^{2}\right)} \]
                                              7. Step-by-step derivation
                                                1. *-lowering-*.f64N/A

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

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

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

                                                  \[\leadsto \mathsf{*.f64}\left(th, \mathsf{+.f64}\left(1, \left(\left(th \cdot th\right) \cdot \frac{-1}{6}\right)\right)\right) \]
                                                5. associate-*l*N/A

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

                                                  \[\leadsto \mathsf{*.f64}\left(th, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(th, \color{blue}{\left(th \cdot \frac{-1}{6}\right)}\right)\right)\right) \]
                                                7. *-lowering-*.f645.8%

                                                  \[\leadsto \mathsf{*.f64}\left(th, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(th, \mathsf{*.f64}\left(th, \color{blue}{\frac{-1}{6}}\right)\right)\right)\right) \]
                                              8. Simplified5.8%

                                                \[\leadsto \color{blue}{th \cdot \left(1 + th \cdot \left(th \cdot -0.16666666666666666\right)\right)} \]
                                              9. Taylor expanded in th around inf

                                                \[\leadsto \color{blue}{\frac{-1}{6} \cdot {th}^{3}} \]
                                              10. Step-by-step derivation
                                                1. *-lowering-*.f64N/A

                                                  \[\leadsto \mathsf{*.f64}\left(\frac{-1}{6}, \color{blue}{\left({th}^{3}\right)}\right) \]
                                                2. cube-multN/A

                                                  \[\leadsto \mathsf{*.f64}\left(\frac{-1}{6}, \left(th \cdot \color{blue}{\left(th \cdot th\right)}\right)\right) \]
                                                3. unpow2N/A

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

                                                  \[\leadsto \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(th, \color{blue}{\left({th}^{2}\right)}\right)\right) \]
                                                5. unpow2N/A

                                                  \[\leadsto \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(th, \left(th \cdot \color{blue}{th}\right)\right)\right) \]
                                                6. *-lowering-*.f649.3%

                                                  \[\leadsto \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(th, \mathsf{*.f64}\left(th, \color{blue}{th}\right)\right)\right) \]
                                              11. Simplified9.3%

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

                                            Alternative 23: 13.7% accurate, 709.0× speedup?

                                            \[\begin{array}{l} \\ th \end{array} \]
                                            (FPCore (kx ky th) :precision binary64 th)
                                            double code(double kx, double ky, double th) {
                                            	return th;
                                            }
                                            
                                            real(8) function code(kx, ky, th)
                                                real(8), intent (in) :: kx
                                                real(8), intent (in) :: ky
                                                real(8), intent (in) :: th
                                                code = th
                                            end function
                                            
                                            public static double code(double kx, double ky, double th) {
                                            	return th;
                                            }
                                            
                                            def code(kx, ky, th):
                                            	return th
                                            
                                            function code(kx, ky, th)
                                            	return th
                                            end
                                            
                                            function tmp = code(kx, ky, th)
                                            	tmp = th;
                                            end
                                            
                                            code[kx_, ky_, th_] := th
                                            
                                            \begin{array}{l}
                                            
                                            \\
                                            th
                                            \end{array}
                                            
                                            Derivation
                                            1. Initial program 90.8%

                                              \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
                                            2. Add Preprocessing
                                            3. Taylor expanded in kx around 0

                                              \[\leadsto \color{blue}{\sin th} \]
                                            4. Step-by-step derivation
                                              1. sin-lowering-sin.f6418.4%

                                                \[\leadsto \mathsf{sin.f64}\left(th\right) \]
                                            5. Simplified18.4%

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

                                              \[\leadsto \color{blue}{th} \]
                                            7. Step-by-step derivation
                                              1. Simplified10.6%

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

                                              Reproduce

                                              ?
                                              herbie shell --seed 2024191 
                                              (FPCore (kx ky th)
                                                :name "Toniolo and Linder, Equation (3b), real"
                                                :precision binary64
                                                (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))