Average Error: 3.9 → 0.2
Time: 38.1s
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
Error34.3
Cost39248
\[\begin{array}{l} t_1 := \sin th \cdot \frac{ky}{\sin kx}\\ \mathbf{if}\;\sin ky \leq -0.02:\\ \;\;\;\;\left|\sin th\right|\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-202}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-72}:\\ \;\;\;\;\frac{\sin th}{1 + 0.5 \cdot \left(\frac{kx}{ky} \cdot \frac{kx}{ky}\right)}\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-28}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 2
Error34.3
Cost39248
\[\begin{array}{l} t_1 := ky \cdot \frac{\sin th}{\sin kx}\\ \mathbf{if}\;\sin ky \leq -0.02:\\ \;\;\;\;\left|\sin th\right|\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-202}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-72}:\\ \;\;\;\;\frac{\sin th}{1 + 0.5 \cdot \left(\frac{kx}{ky} \cdot \frac{kx}{ky}\right)}\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-28}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 3
Error34.3
Cost39248
\[\begin{array}{l} \mathbf{if}\;\sin ky \leq -0.02:\\ \;\;\;\;\left|\sin th\right|\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-202}:\\ \;\;\;\;\frac{ky}{\frac{\sin kx}{\sin th}}\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-72}:\\ \;\;\;\;\frac{\sin th}{1 + 0.5 \cdot \left(\frac{kx}{ky} \cdot \frac{kx}{ky}\right)}\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-28}:\\ \;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 4
Error34.3
Cost39248
\[\begin{array}{l} \mathbf{if}\;\sin ky \leq -0.02:\\ \;\;\;\;\left|\sin th\right|\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-202}:\\ \;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-72}:\\ \;\;\;\;\frac{\sin th}{1 + 0.5 \cdot \left(\frac{kx}{ky} \cdot \frac{kx}{ky}\right)}\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-28}:\\ \;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 5
Error34.3
Cost39248
\[\begin{array}{l} t_1 := \frac{\sin th}{\sin kx}\\ \mathbf{if}\;\sin ky \leq -0.06:\\ \;\;\;\;\left|\sin th\right|\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-202}:\\ \;\;\;\;\sin ky \cdot t_1\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-72}:\\ \;\;\;\;\frac{\sin th}{1 + 0.5 \cdot \left(\frac{kx}{ky} \cdot \frac{kx}{ky}\right)}\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-28}:\\ \;\;\;\;ky \cdot t_1\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 6
Error34.3
Cost39248
\[\begin{array}{l} \mathbf{if}\;\sin ky \leq -0.06:\\ \;\;\;\;\left|\sin th\right|\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-202}:\\ \;\;\;\;\frac{\sin ky}{\frac{\sin kx}{\sin th}}\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-72}:\\ \;\;\;\;\frac{\sin th}{1 + 0.5 \cdot \left(\frac{kx}{ky} \cdot \frac{kx}{ky}\right)}\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-28}:\\ \;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 7
Error34.3
Cost39248
\[\begin{array}{l} \mathbf{if}\;\sin ky \leq -0.06:\\ \;\;\;\;\left|\sin th\right|\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-202}:\\ \;\;\;\;\frac{\sin th}{\frac{\sin kx}{\sin ky}}\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-72}:\\ \;\;\;\;\frac{\sin th}{1 + 0.5 \cdot \left(\frac{kx}{ky} \cdot \frac{kx}{ky}\right)}\\ \mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-28}:\\ \;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 8
Error0.3
Cost32384
\[\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \]
Alternative 9
Error0.2
Cost32384
\[\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \]
Alternative 10
Error25.8
Cost26896
\[\begin{array}{l} t_1 := \left|\sin th\right|\\ \mathbf{if}\;th \leq -1.6974663552154602 \cdot 10^{+212}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;th \leq -1.3149443922293006 \cdot 10^{+187}:\\ \;\;\;\;\frac{\sin th}{1 + 0.5 \cdot {\left(\frac{kx}{\sin ky}\right)}^{2}}\\ \mathbf{elif}\;th \leq -5.985297732902645 \cdot 10^{+59}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;th \leq 0.009527659020812373:\\ \;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin kx, \sin ky\right) \cdot \left(\frac{1}{th} + th \cdot 0.16666666666666666\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sin ky}{\frac{\sin kx}{\sin th}}\\ \end{array} \]
Alternative 11
Error25.9
Cost26512
\[\begin{array}{l} t_1 := \left|\sin th\right|\\ \mathbf{if}\;th \leq -1.6974663552154602 \cdot 10^{+212}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;th \leq -1.3149443922293006 \cdot 10^{+187}:\\ \;\;\;\;\frac{\sin th}{1 + 0.5 \cdot {\left(\frac{kx}{\sin ky}\right)}^{2}}\\ \mathbf{elif}\;th \leq -5.985297732902645 \cdot 10^{+59}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;th \leq 0.009527659020812373:\\ \;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sin ky}{\frac{\sin kx}{\sin th}}\\ \end{array} \]
Alternative 12
Error38.8
Cost19396
\[\begin{array}{l} \mathbf{if}\;\sin ky \leq -5 \cdot 10^{-153}:\\ \;\;\;\;\left|\sin th\right|\\ \mathbf{else}:\\ \;\;\;\;\frac{\sin th}{1 + 0.5 \cdot \left(\frac{kx}{ky} \cdot \frac{kx}{ky}\right)}\\ \end{array} \]
Alternative 13
Error46.6
Cost7760
\[\begin{array}{l} t_1 := \frac{\sin th}{1 + 0.5 \cdot \left(\frac{kx}{ky} \cdot \frac{kx}{ky}\right)}\\ \mathbf{if}\;th \leq -4.3240458838987326 \cdot 10^{-5}:\\ \;\;\;\;\sin th\\ \mathbf{elif}\;th \leq -7.451787557033381 \cdot 10^{-90}:\\ \;\;\;\;-th\\ \mathbf{elif}\;th \leq -4.874963749779373 \cdot 10^{-165}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;th \leq 3.588311082905581 \cdot 10^{-293}:\\ \;\;\;\;-th\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 14
Error48.5
Cost7256
\[\begin{array}{l} \mathbf{if}\;th \leq -4.3240458838987326 \cdot 10^{-5}:\\ \;\;\;\;\sin th\\ \mathbf{elif}\;th \leq -7.451787557033381 \cdot 10^{-90}:\\ \;\;\;\;-th\\ \mathbf{elif}\;th \leq -4.874963749779373 \cdot 10^{-165}:\\ \;\;\;\;th\\ \mathbf{elif}\;th \leq 3.588311082905581 \cdot 10^{-293}:\\ \;\;\;\;-th\\ \mathbf{elif}\;th \leq 7.841834459881988 \cdot 10^{-201}:\\ \;\;\;\;\frac{\left(th + 1\right) \cdot \left(th + 1\right) + -1}{1 + \left(th + 1\right)}\\ \mathbf{elif}\;th \leq 1.256769718056429 \cdot 10^{-13}:\\ \;\;\;\;-th\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 15
Error46.2
Cost6984
\[\begin{array}{l} \mathbf{if}\;ky \leq -2.1037771189749724 \cdot 10^{-153}:\\ \;\;\;\;-th\\ \mathbf{elif}\;ky \leq 8.380301009989771 \cdot 10^{-196}:\\ \;\;\;\;\left(\sin th + 1\right) + -1\\ \mathbf{else}:\\ \;\;\;\;\sin th\\ \end{array} \]
Alternative 16
Error50.9
Cost656
\[\begin{array}{l} \mathbf{if}\;ky \leq -2.1037771189749724 \cdot 10^{-153}:\\ \;\;\;\;-th\\ \mathbf{elif}\;ky \leq 8.380301009989771 \cdot 10^{-196}:\\ \;\;\;\;\left(th + 1\right) + -1\\ \mathbf{elif}\;ky \leq 1.204794868872607 \cdot 10^{+24}:\\ \;\;\;\;th\\ \mathbf{elif}\;ky \leq 3.475511135628588 \cdot 10^{+216}:\\ \;\;\;\;-th\\ \mathbf{else}:\\ \;\;\;\;th\\ \end{array} \]
Alternative 17
Error53.6
Cost392
\[\begin{array}{l} \mathbf{if}\;ky \leq -1.3532842698285966 \cdot 10^{-281}:\\ \;\;\;\;-th\\ \mathbf{elif}\;ky \leq 1.204794868872607 \cdot 10^{+24}:\\ \;\;\;\;th\\ \mathbf{else}:\\ \;\;\;\;-th\\ \end{array} \]
Alternative 18
Error55.2
Cost64
\[th \]

Error

Reproduce

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