?

Average Error: 31.0 → 31.0
Time: 29.9s
Precision: binary64
Cost: 92352

?

\[\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right) \]
\[\begin{array}{l} t_0 := \pi \cdot \frac{angle}{180}\\ t_1 := \cos t_0\\ t_2 := \sin t_0\\ \left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot t_2\right) \cdot \left(\frac{1 + \left(t_1 \cdot t_1 - t_2 \cdot t_2\right)}{2} \cdot \frac{1}{t_1}\right) \end{array} \]
(FPCore (a b angle)
 :precision binary64
 (*
  (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) (sin (* PI (/ angle 180.0))))
  (cos (* PI (/ angle 180.0)))))
(FPCore (a b angle)
 :precision binary64
 (let* ((t_0 (* PI (/ angle 180.0))) (t_1 (cos t_0)) (t_2 (sin t_0)))
   (*
    (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) t_2)
    (* (/ (+ 1.0 (- (* t_1 t_1) (* t_2 t_2))) 2.0) (/ 1.0 t_1)))))
double code(double a, double b, double angle) {
	return ((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * sin((((double) M_PI) * (angle / 180.0)))) * cos((((double) M_PI) * (angle / 180.0)));
}
double code(double a, double b, double angle) {
	double t_0 = ((double) M_PI) * (angle / 180.0);
	double t_1 = cos(t_0);
	double t_2 = sin(t_0);
	return ((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * t_2) * (((1.0 + ((t_1 * t_1) - (t_2 * t_2))) / 2.0) * (1.0 / t_1));
}
public static double code(double a, double b, double angle) {
	return ((2.0 * (Math.pow(b, 2.0) - Math.pow(a, 2.0))) * Math.sin((Math.PI * (angle / 180.0)))) * Math.cos((Math.PI * (angle / 180.0)));
}
public static double code(double a, double b, double angle) {
	double t_0 = Math.PI * (angle / 180.0);
	double t_1 = Math.cos(t_0);
	double t_2 = Math.sin(t_0);
	return ((2.0 * (Math.pow(b, 2.0) - Math.pow(a, 2.0))) * t_2) * (((1.0 + ((t_1 * t_1) - (t_2 * t_2))) / 2.0) * (1.0 / t_1));
}
def code(a, b, angle):
	return ((2.0 * (math.pow(b, 2.0) - math.pow(a, 2.0))) * math.sin((math.pi * (angle / 180.0)))) * math.cos((math.pi * (angle / 180.0)))
def code(a, b, angle):
	t_0 = math.pi * (angle / 180.0)
	t_1 = math.cos(t_0)
	t_2 = math.sin(t_0)
	return ((2.0 * (math.pow(b, 2.0) - math.pow(a, 2.0))) * t_2) * (((1.0 + ((t_1 * t_1) - (t_2 * t_2))) / 2.0) * (1.0 / t_1))
function code(a, b, angle)
	return Float64(Float64(Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) * sin(Float64(pi * Float64(angle / 180.0)))) * cos(Float64(pi * Float64(angle / 180.0))))
end
function code(a, b, angle)
	t_0 = Float64(pi * Float64(angle / 180.0))
	t_1 = cos(t_0)
	t_2 = sin(t_0)
	return Float64(Float64(Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) * t_2) * Float64(Float64(Float64(1.0 + Float64(Float64(t_1 * t_1) - Float64(t_2 * t_2))) / 2.0) * Float64(1.0 / t_1)))
end
function tmp = code(a, b, angle)
	tmp = ((2.0 * ((b ^ 2.0) - (a ^ 2.0))) * sin((pi * (angle / 180.0)))) * cos((pi * (angle / 180.0)));
end
function tmp = code(a, b, angle)
	t_0 = pi * (angle / 180.0);
	t_1 = cos(t_0);
	t_2 = sin(t_0);
	tmp = ((2.0 * ((b ^ 2.0) - (a ^ 2.0))) * t_2) * (((1.0 + ((t_1 * t_1) - (t_2 * t_2))) / 2.0) * (1.0 / t_1));
end
code[a_, b_, angle_] := N[(N[(N[(2.0 * N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
code[a_, b_, angle_] := Block[{t$95$0 = N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[t$95$0], $MachinePrecision]}, Block[{t$95$2 = N[Sin[t$95$0], $MachinePrecision]}, N[(N[(N[(2.0 * N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision] * N[(N[(N[(1.0 + N[(N[(t$95$1 * t$95$1), $MachinePrecision] - N[(t$95$2 * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] * N[(1.0 / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)
\begin{array}{l}
t_0 := \pi \cdot \frac{angle}{180}\\
t_1 := \cos t_0\\
t_2 := \sin t_0\\
\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot t_2\right) \cdot \left(\frac{1 + \left(t_1 \cdot t_1 - t_2 \cdot t_2\right)}{2} \cdot \frac{1}{t_1}\right)
\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 31.0

    \[\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right) \]
  2. Applied egg-rr31.0

    \[\leadsto \left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \color{blue}{\left(\frac{1 + \cos \left(\left(\pi \cdot \frac{angle}{180}\right) \cdot 2\right)}{2} \cdot \frac{1}{\cos \left(\pi \cdot \frac{angle}{180}\right)}\right)} \]
  3. Applied egg-rr31.0

    \[\leadsto \left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \left(\frac{1 + \color{blue}{\left(\cos \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right) - \sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}}{2} \cdot \frac{1}{\cos \left(\pi \cdot \frac{angle}{180}\right)}\right) \]
  4. Final simplification31.0

    \[\leadsto \left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \left(\frac{1 + \left(\cos \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right) - \sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}{2} \cdot \frac{1}{\cos \left(\pi \cdot \frac{angle}{180}\right)}\right) \]

Alternatives

Alternative 1
Error31.0
Cost66752
\[\begin{array}{l} t_0 := \pi \cdot \frac{angle}{180}\\ \left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin t_0\right) \cdot \left(\frac{1 + \frac{1 + \cos \left(\pi \cdot \left(\frac{angle}{180} \cdot 4\right)\right)}{2} \cdot \frac{1}{\cos \left(\pi \cdot \left(\frac{angle}{180} \cdot 2\right)\right)}}{2} \cdot \frac{1}{\cos t_0}\right) \end{array} \]
Alternative 2
Error31.2
Cost32964
\[\begin{array}{l} \mathbf{if}\;{b}^{2} - {a}^{2} \leq -5 \cdot 10^{-241}:\\ \;\;\;\;\sin \left(\pi \cdot \left(0.011111111111111112 \cdot angle\right)\right) \cdot \left(-1 \cdot {a}^{2}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right) \cdot {b}^{2}\\ \end{array} \]
Alternative 3
Error31.0
Cost26368
\[\left({b}^{2} - {a}^{2}\right) \cdot \sin \left(2 \cdot \left(\pi \cdot \frac{angle}{180}\right)\right) \]
Alternative 4
Error30.9
Cost26240
\[\left({b}^{2} - {a}^{2}\right) \cdot \sin \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right) \]
Alternative 5
Error35.7
Cost19976
\[\begin{array}{l} t_0 := \sin \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right)\\ \mathbf{if}\;b \leq -205000:\\ \;\;\;\;t_0 \cdot {b}^{2}\\ \mathbf{elif}\;b \leq 2.5 \cdot 10^{+22}:\\ \;\;\;\;-{a}^{2} \cdot t_0\\ \mathbf{else}:\\ \;\;\;\;{b}^{2} \cdot \sin \left(\pi \cdot \left(0.011111111111111112 \cdot angle\right)\right)\\ \end{array} \]
Alternative 6
Error35.7
Cost19976
\[\begin{array}{l} \mathbf{if}\;b \leq -205000:\\ \;\;\;\;\sin \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right) \cdot {b}^{2}\\ \mathbf{elif}\;b \leq 2.55 \cdot 10^{+22}:\\ \;\;\;\;\sin \left(angle \cdot \left(0.011111111111111112 \cdot \pi\right)\right) \cdot \left(-{a}^{2}\right)\\ \mathbf{else}:\\ \;\;\;\;{b}^{2} \cdot \sin \left(\pi \cdot \left(0.011111111111111112 \cdot angle\right)\right)\\ \end{array} \]
Alternative 7
Error36.0
Cost19912
\[\begin{array}{l} \mathbf{if}\;a \leq -4.8 \cdot 10^{-83}:\\ \;\;\;\;\left(angle \cdot \left(0.011111111111111112 \cdot \pi\right)\right) \cdot \left(-1 \cdot {a}^{2}\right)\\ \mathbf{elif}\;a \leq 4.45 \cdot 10^{-10}:\\ \;\;\;\;\sin \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right) \cdot {b}^{2}\\ \mathbf{else}:\\ \;\;\;\;angle \cdot \left({a}^{2} \cdot \left(\pi \cdot -0.011111111111111112\right)\right)\\ \end{array} \]
Alternative 8
Error37.8
Cost13640
\[\begin{array}{l} \mathbf{if}\;b \leq -490000000:\\ \;\;\;\;angle \cdot \left(0.011111111111111112 \cdot \left({b}^{2} \cdot \pi\right)\right)\\ \mathbf{elif}\;b \leq 6 \cdot 10^{+25}:\\ \;\;\;\;\left(angle \cdot \left(0.011111111111111112 \cdot \pi\right)\right) \cdot \left(-1 \cdot {a}^{2}\right)\\ \mathbf{else}:\\ \;\;\;\;angle \cdot \left(\pi \cdot \left(0.011111111111111112 \cdot {b}^{2}\right)\right)\\ \end{array} \]
Alternative 9
Error37.8
Cost13512
\[\begin{array}{l} t_0 := 0.011111111111111112 \cdot \left(angle \cdot \left({b}^{2} \cdot \pi\right)\right)\\ \mathbf{if}\;b \leq -2800000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;b \leq 5.2 \cdot 10^{+25}:\\ \;\;\;\;-0.011111111111111112 \cdot \left({a}^{2} \cdot \left(angle \cdot \pi\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 10
Error37.8
Cost13512
\[\begin{array}{l} t_0 := 0.011111111111111112 \cdot \left(angle \cdot \left({b}^{2} \cdot \pi\right)\right)\\ \mathbf{if}\;b \leq -3300000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;b \leq 6 \cdot 10^{+24}:\\ \;\;\;\;angle \cdot \left(-0.011111111111111112 \cdot \left({a}^{2} \cdot \pi\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 11
Error37.8
Cost13512
\[\begin{array}{l} t_0 := {b}^{2} \cdot \pi\\ \mathbf{if}\;b \leq -400000:\\ \;\;\;\;angle \cdot \left(0.011111111111111112 \cdot t_0\right)\\ \mathbf{elif}\;b \leq 6 \cdot 10^{+24}:\\ \;\;\;\;angle \cdot \left(-0.011111111111111112 \cdot \left({a}^{2} \cdot \pi\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.011111111111111112 \cdot \left(angle \cdot t_0\right)\\ \end{array} \]
Alternative 12
Error37.8
Cost13512
\[\begin{array}{l} \mathbf{if}\;b \leq -1020000:\\ \;\;\;\;angle \cdot \left(0.011111111111111112 \cdot \left({b}^{2} \cdot \pi\right)\right)\\ \mathbf{elif}\;b \leq 4.4 \cdot 10^{+24}:\\ \;\;\;\;angle \cdot \left(-0.011111111111111112 \cdot \left({a}^{2} \cdot \pi\right)\right)\\ \mathbf{else}:\\ \;\;\;\;angle \cdot \left(\pi \cdot \left(0.011111111111111112 \cdot {b}^{2}\right)\right)\\ \end{array} \]
Alternative 13
Error37.8
Cost13512
\[\begin{array}{l} \mathbf{if}\;b \leq -1700000:\\ \;\;\;\;angle \cdot \left(0.011111111111111112 \cdot \left({b}^{2} \cdot \pi\right)\right)\\ \mathbf{elif}\;b \leq 4.4 \cdot 10^{+24}:\\ \;\;\;\;angle \cdot \left(\pi \cdot \left({a}^{2} \cdot -0.011111111111111112\right)\right)\\ \mathbf{else}:\\ \;\;\;\;angle \cdot \left(\pi \cdot \left(0.011111111111111112 \cdot {b}^{2}\right)\right)\\ \end{array} \]
Alternative 14
Error43.2
Cost13248
\[-0.011111111111111112 \cdot \left(angle \cdot \left({a}^{2} \cdot \pi\right)\right) \]
Alternative 15
Error43.2
Cost13248
\[-0.011111111111111112 \cdot \left({a}^{2} \cdot \left(angle \cdot \pi\right)\right) \]
Alternative 16
Error51.9
Cost6656
\[0 \cdot {b}^{2} \]

Error

Reproduce?

herbie shell --seed 2023088 
(FPCore (a b angle)
  :name "ab-angle->ABCF B"
  :precision binary64
  (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) (sin (* PI (/ angle 180.0)))) (cos (* PI (/ angle 180.0)))))