Average Error: 31.5 → 21.4
Time: 21.3s
Precision: binary64
Cost: 26368
\[\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) \]
\[\left(\mathsf{log1p}\left(\mathsf{expm1}\left(\sin \left(angle \cdot \left(\pi \cdot 0.011111111111111112\right)\right)\right)\right) \cdot \left(b + a\right)\right) \cdot \left(b - a\right) \]
(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
 (*
  (* (log1p (expm1 (sin (* angle (* PI 0.011111111111111112))))) (+ b a))
  (- b a)))
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) {
	return (log1p(expm1(sin((angle * (((double) M_PI) * 0.011111111111111112))))) * (b + a)) * (b - a);
}
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) {
	return (Math.log1p(Math.expm1(Math.sin((angle * (Math.PI * 0.011111111111111112))))) * (b + a)) * (b - a);
}
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):
	return (math.log1p(math.expm1(math.sin((angle * (math.pi * 0.011111111111111112))))) * (b + a)) * (b - a)
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)
	return Float64(Float64(log1p(expm1(sin(Float64(angle * Float64(pi * 0.011111111111111112))))) * Float64(b + a)) * Float64(b - a))
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_] := N[(N[(N[Log[1 + N[(Exp[N[Sin[N[(angle * N[(Pi * 0.011111111111111112), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision] * N[(b + a), $MachinePrecision]), $MachinePrecision] * N[(b - a), $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)
\left(\mathsf{log1p}\left(\mathsf{expm1}\left(\sin \left(angle \cdot \left(\pi \cdot 0.011111111111111112\right)\right)\right)\right) \cdot \left(b + a\right)\right) \cdot \left(b - a\right)

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 31.5

    \[\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. Simplified31.5

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

    \[\leadsto \color{blue}{\sqrt{{\left(\left(b \cdot b - a \cdot a\right) \cdot \sin \left(2 \cdot \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right)\right)\right)}^{2}}} \]
  4. Applied egg-rr21.4

    \[\leadsto \color{blue}{\left(\sin \left(\left(0.005555555555555556 \cdot \pi\right) \cdot \left(2 \cdot angle\right)\right) \cdot \left(b + a\right)\right) \cdot \left(b - a\right)} \]
  5. Applied egg-rr21.4

    \[\leadsto \left(\color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\sin \left(angle \cdot \left(\pi \cdot 0.011111111111111112\right)\right)\right)\right)} \cdot \left(b + a\right)\right) \cdot \left(b - a\right) \]
  6. Final simplification21.4

    \[\leadsto \left(\mathsf{log1p}\left(\mathsf{expm1}\left(\sin \left(angle \cdot \left(\pi \cdot 0.011111111111111112\right)\right)\right)\right) \cdot \left(b + a\right)\right) \cdot \left(b - a\right) \]

Alternatives

Alternative 1
Error22.9
Cost13576
\[\begin{array}{l} t_0 := angle \cdot \left(\pi \cdot 0.011111111111111112\right)\\ t_1 := \sin t_0 \cdot \left(b \cdot b\right)\\ \mathbf{if}\;angle \leq -4.4 \cdot 10^{-9}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;angle \leq 3.8 \cdot 10^{-6}:\\ \;\;\;\;\left(b - a\right) \cdot \left(\left(b + a\right) \cdot t_0\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Error21.4
Cost13568
\[\left(b - a\right) \cdot \left(\left(b + a\right) \cdot \sin \left(angle \cdot \left(\pi \cdot 0.011111111111111112\right)\right)\right) \]
Alternative 3
Error25.1
Cost13380
\[\begin{array}{l} \mathbf{if}\;angle \leq -7.5 \cdot 10^{-6}:\\ \;\;\;\;0.011111111111111112 \cdot \left(angle \cdot \left(\pi \cdot {b}^{2}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(b - a\right) \cdot \left(\left(b + a\right) \cdot \left(angle \cdot \left(\pi \cdot 0.011111111111111112\right)\right)\right)\\ \end{array} \]
Alternative 4
Error30.1
Cost7432
\[\begin{array}{l} t_0 := \pi \cdot \left(a \cdot \left(a \cdot \left(angle \cdot -0.011111111111111112\right)\right)\right)\\ \mathbf{if}\;a \leq -1.2767636737649875 \cdot 10^{+152}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;a \leq 7761425756558442000:\\ \;\;\;\;0.011111111111111112 \cdot \left(angle \cdot \left(\left(b - a\right) \cdot \left(\pi \cdot \left(b + a\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Error25.2
Cost7300
\[\begin{array}{l} \mathbf{if}\;angle \leq -4.4 \cdot 10^{-9}:\\ \;\;\;\;angle \cdot \left(\left(\pi \cdot 0.011111111111111112\right) \cdot \left(b \cdot b\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(b - a\right) \cdot \left(0.011111111111111112 \cdot \left(angle \cdot \left(\pi \cdot \left(b + a\right)\right)\right)\right)\\ \end{array} \]
Alternative 6
Error25.1
Cost7300
\[\begin{array}{l} \mathbf{if}\;angle \leq -0.028:\\ \;\;\;\;angle \cdot \left(\left(\pi \cdot 0.011111111111111112\right) \cdot \left(b \cdot b\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(b - a\right) \cdot \left(\left(b + a\right) \cdot \left(angle \cdot \left(\pi \cdot 0.011111111111111112\right)\right)\right)\\ \end{array} \]
Alternative 7
Error33.6
Cost7176
\[\begin{array}{l} t_0 := \pi \cdot \left(\left(angle \cdot a\right) \cdot \left(a \cdot -0.011111111111111112\right)\right)\\ \mathbf{if}\;a \leq -4.7839323881146706 \cdot 10^{+55}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;a \leq 7.67253897484111 \cdot 10^{-27}:\\ \;\;\;\;angle \cdot \left(\left(\pi \cdot 0.011111111111111112\right) \cdot \left(b \cdot b\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 8
Error33.6
Cost7176
\[\begin{array}{l} t_0 := \pi \cdot \left(a \cdot \left(a \cdot \left(angle \cdot -0.011111111111111112\right)\right)\right)\\ \mathbf{if}\;a \leq -4.7839323881146706 \cdot 10^{+55}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;a \leq 7.67253897484111 \cdot 10^{-27}:\\ \;\;\;\;angle \cdot \left(\left(\pi \cdot 0.011111111111111112\right) \cdot \left(b \cdot b\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 9
Error43.6
Cost6912
\[angle \cdot \left(a \cdot \left(-0.011111111111111112 \cdot \left(\pi \cdot a\right)\right)\right) \]
Alternative 10
Error40.0
Cost6912
\[\pi \cdot \left(\left(angle \cdot a\right) \cdot \left(a \cdot -0.011111111111111112\right)\right) \]

Error

Reproduce

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