Average Error: 4.1 → 3.1
Time: 10.4s
Precision: 64
\[\frac{\sin ky}{\sqrt{{\left(\sin kx\right)}^{2} + {\left(\sin ky\right)}^{2}}} \cdot \sin th\]
\[\begin{array}{l} \mathbf{if}\;\frac{\sin ky}{\sqrt{{\left(\sin kx\right)}^{2} + {\left(\sin ky\right)}^{2}}} \le 0.99999999136618389:\\ \;\;\;\;\frac{\frac{1}{\sqrt{{\left(\sin kx\right)}^{2} + {\left(\sin ky\right)}^{2}}}}{\frac{1}{\sin ky}} \cdot \sin th\\ \mathbf{else}:\\ \;\;\;\;\left(1 - \frac{1}{6} \cdot {kx}^{2}\right) \cdot \sin th\\ \end{array}\]
\frac{\sin ky}{\sqrt{{\left(\sin kx\right)}^{2} + {\left(\sin ky\right)}^{2}}} \cdot \sin th
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\left(\sin kx\right)}^{2} + {\left(\sin ky\right)}^{2}}} \le 0.99999999136618389:\\
\;\;\;\;\frac{\frac{1}{\sqrt{{\left(\sin kx\right)}^{2} + {\left(\sin ky\right)}^{2}}}}{\frac{1}{\sin ky}} \cdot \sin th\\

\mathbf{else}:\\
\;\;\;\;\left(1 - \frac{1}{6} \cdot {kx}^{2}\right) \cdot \sin th\\

\end{array}
double code(double kx, double ky, double th) {
	return ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th));
}
double code(double kx, double ky, double th) {
	double VAR;
	if (((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= 0.9999999913661839)) {
		VAR = (((1.0 / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) / (1.0 / sin(ky))) * sin(th));
	} else {
		VAR = ((1.0 - (0.16666666666666666 * pow(kx, 2.0))) * sin(th));
	}
	return VAR;
}

Error

Bits error versus kx

Bits error versus ky

Bits error versus th

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) < 0.9999999913661839

    1. Initial program 2.7

      \[\frac{\sin ky}{\sqrt{{\left(\sin kx\right)}^{2} + {\left(\sin ky\right)}^{2}}} \cdot \sin th\]
    2. Using strategy rm
    3. Applied clear-num2.8

      \[\leadsto \color{blue}{\frac{1}{\frac{\sqrt{{\left(\sin kx\right)}^{2} + {\left(\sin ky\right)}^{2}}}{\sin ky}}} \cdot \sin th\]
    4. Using strategy rm
    5. Applied div-inv2.8

      \[\leadsto \frac{1}{\color{blue}{\sqrt{{\left(\sin kx\right)}^{2} + {\left(\sin ky\right)}^{2}} \cdot \frac{1}{\sin ky}}} \cdot \sin th\]
    6. Applied associate-/r*2.8

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

    if 0.9999999913661839 < (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))

    1. Initial program 9.6

      \[\frac{\sin ky}{\sqrt{{\left(\sin kx\right)}^{2} + {\left(\sin ky\right)}^{2}}} \cdot \sin th\]
    2. Using strategy rm
    3. Applied clear-num9.6

      \[\leadsto \color{blue}{\frac{1}{\frac{\sqrt{{\left(\sin kx\right)}^{2} + {\left(\sin ky\right)}^{2}}}{\sin ky}}} \cdot \sin th\]
    4. Taylor expanded around 0 4.4

      \[\leadsto \color{blue}{\left(1 - \frac{1}{6} \cdot {kx}^{2}\right)} \cdot \sin th\]
  3. Recombined 2 regimes into one program.
  4. Final simplification3.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sin ky}{\sqrt{{\left(\sin kx\right)}^{2} + {\left(\sin ky\right)}^{2}}} \le 0.99999999136618389:\\ \;\;\;\;\frac{\frac{1}{\sqrt{{\left(\sin kx\right)}^{2} + {\left(\sin ky\right)}^{2}}}}{\frac{1}{\sin ky}} \cdot \sin th\\ \mathbf{else}:\\ \;\;\;\;\left(1 - \frac{1}{6} \cdot {kx}^{2}\right) \cdot \sin th\\ \end{array}\]

Reproduce

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