Average Error: 3.9 → 0.2
Time: 27.9s
Precision: binary64
Cost: 32384
\[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
\[\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{\sin ky}} \]
(FPCore (kx ky th)
 :precision binary64
 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
(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(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
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(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
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(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(th) / (math.hypot(math.sin(kx), math.sin(ky)) / math.sin(ky))
function code(kx, ky, th)
	return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th))
end
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(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th);
end
function tmp = code(kx, ky, th)
	tmp = sin(th) / (hypot(sin(kx), sin(ky)) / sin(ky));
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]
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]
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{\sin ky}}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 3.9

    \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \]
  2. Applied egg-rr0.2

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

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

Alternatives

Alternative 1
Error24.8
Cost39244
\[\begin{array}{l} \mathbf{if}\;\sin th \leq -0.02:\\ \;\;\;\;\sin th\\ \mathbf{elif}\;\sin th \leq 0.0001:\\ \;\;\;\;th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\ \mathbf{elif}\;\sin th \leq 0.53:\\ \;\;\;\;\frac{\sin th \cdot \sin ky}{\sin kx}\\ \mathbf{else}:\\ \;\;\;\;\sin th \cdot \left(\sin ky \cdot \frac{-1}{\sin kx}\right)\\ \end{array} \]
Alternative 2
Error24.8
Cost39244
\[\begin{array}{l} \mathbf{if}\;\sin th \leq -0.02:\\ \;\;\;\;\sin th\\ \mathbf{elif}\;\sin th \leq 0.0001:\\ \;\;\;\;\frac{th}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{\sin ky}}\\ \mathbf{elif}\;\sin th \leq 0.53:\\ \;\;\;\;\frac{\sin th \cdot \sin ky}{\sin kx}\\ \mathbf{else}:\\ \;\;\;\;\sin th \cdot \left(\sin ky \cdot \frac{-1}{\sin kx}\right)\\ \end{array} \]
Alternative 3
Error34.1
Cost32584
\[\begin{array}{l} \mathbf{if}\;\sin ky \leq -5 \cdot 10^{-64}:\\ \;\;\;\;\left|\sin th\right|\\ \mathbf{elif}\;\sin ky \leq 10^{-48}:\\ \;\;\;\;\frac{\sin th}{\frac{\sin kx}{\sin ky}}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 4
Error34.1
Cost32584
\[\begin{array}{l} \mathbf{if}\;\sin ky \leq -5 \cdot 10^{-64}:\\ \;\;\;\;\left|\sin th\right|\\ \mathbf{elif}\;\sin ky \leq 10^{-48}:\\ \;\;\;\;\mathsf{expm1}\left(ky \cdot \frac{\sin th}{\sin kx}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 5
Error30.7
Cost32584
\[\begin{array}{l} \mathbf{if}\;\sin kx \leq -1 \cdot 10^{-146}:\\ \;\;\;\;\left(-\sin th\right) \cdot \frac{\sin ky}{\sin kx}\\ \mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-149}:\\ \;\;\;\;\sin th\\ \mathbf{else}:\\ \;\;\;\;\frac{\sin th}{\frac{\sin kx}{\sin ky}}\\ \end{array} \]
Alternative 6
Error0.3
Cost32384
\[\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{\sin th}} \]
Alternative 7
Error34.1
Cost26184
\[\begin{array}{l} \mathbf{if}\;\sin ky \leq -5 \cdot 10^{-64}:\\ \;\;\;\;\left|\sin th\right|\\ \mathbf{elif}\;\sin ky \leq 10^{-48}:\\ \;\;\;\;\frac{ky}{\frac{\sin kx}{\sin th}}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 8
Error34.1
Cost26184
\[\begin{array}{l} \mathbf{if}\;\sin ky \leq -5 \cdot 10^{-64}:\\ \;\;\;\;\left|\sin th\right|\\ \mathbf{elif}\;\sin ky \leq 10^{-48}:\\ \;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 9
Error43.9
Cost12996
\[\begin{array}{l} \mathbf{if}\;ky \leq -2.7639674864632265 \cdot 10^{-142}:\\ \;\;\;\;\left|\sin th\right|\\ \mathbf{elif}\;ky \leq 1.9505960605137301 \cdot 10^{-162}:\\ \;\;\;\;\left(\sin th + 1\right) + -1\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 10
Error44.7
Cost6984
\[\begin{array}{l} \mathbf{if}\;ky \leq -147376411316013.34:\\ \;\;\;\;\sin th\\ \mathbf{elif}\;ky \leq 1.9505960605137301 \cdot 10^{-162}:\\ \;\;\;\;1 + \left(\sin th + -1\right)\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 11
Error44.7
Cost6984
\[\begin{array}{l} \mathbf{if}\;ky \leq -147376411316013.34:\\ \;\;\;\;\sin th\\ \mathbf{elif}\;ky \leq 1.9505960605137301 \cdot 10^{-162}:\\ \;\;\;\;\left(\sin th + 1\right) + -1\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 12
Error45.1
Cost6728
\[\begin{array}{l} \mathbf{if}\;ky \leq -13606441268860.6:\\ \;\;\;\;\sin th\\ \mathbf{elif}\;ky \leq 1.7284319754734886 \cdot 10^{-185}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 13
Error51.1
Cost328
\[\begin{array}{l} \mathbf{if}\;ky \leq -560.315978532113:\\ \;\;\;\;th\\ \mathbf{elif}\;ky \leq 1.9505960605137301 \cdot 10^{-162}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;th\\ \end{array} \]
Alternative 14
Error55.3
Cost64
\[th \]

Error

Reproduce

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