Average Error: 31.7 → 21.3
Time: 24.4s
Precision: binary64
Cost: 13696
\[\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(b + a\right) \cdot \left(\left(b - a\right) \cdot \sin \left(\left(2 \cdot \left(0.005555555555555556 \cdot \pi\right)\right) \cdot angle\right)\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
 (* (+ b a) (* (- b a) (sin (* (* 2.0 (* 0.005555555555555556 PI)) angle)))))
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 (b + a) * ((b - a) * sin(((2.0 * (0.005555555555555556 * ((double) M_PI))) * angle)));
}
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 (b + a) * ((b - a) * Math.sin(((2.0 * (0.005555555555555556 * Math.PI)) * angle)));
}
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 (b + a) * ((b - a) * math.sin(((2.0 * (0.005555555555555556 * math.pi)) * angle)))
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(b + a) * Float64(Float64(b - a) * sin(Float64(Float64(2.0 * Float64(0.005555555555555556 * pi)) * angle))))
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)
	tmp = (b + a) * ((b - a) * sin(((2.0 * (0.005555555555555556 * pi)) * angle)));
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[(b + a), $MachinePrecision] * N[(N[(b - a), $MachinePrecision] * N[Sin[N[(N[(2.0 * N[(0.005555555555555556 * Pi), $MachinePrecision]), $MachinePrecision] * angle), $MachinePrecision]], $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)
\left(b + a\right) \cdot \left(\left(b - a\right) \cdot \sin \left(\left(2 \cdot \left(0.005555555555555556 \cdot \pi\right)\right) \cdot angle\right)\right)

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 31.7

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

    \[\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-rr27.1

    \[\leadsto \color{blue}{\mathsf{fma}\left(b + a, \left(b - a\right) \cdot \sin \left(2 \cdot \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right)\right), \mathsf{fma}\left(a, -a, a \cdot a\right) \cdot \sin \left(2 \cdot \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right)\right)\right)} \]
  4. Taylor expanded in a around 0 21.3

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

    \[\leadsto \color{blue}{\left(b + a\right) \cdot \left(\left(b - a\right) \cdot \sin \left(\left(2 \cdot \left(0.005555555555555556 \cdot \pi\right)\right) \cdot angle\right)\right)} \]
  6. Final simplification21.3

    \[\leadsto \left(b + a\right) \cdot \left(\left(b - a\right) \cdot \sin \left(\left(2 \cdot \left(0.005555555555555556 \cdot \pi\right)\right) \cdot angle\right)\right) \]

Alternatives

Alternative 1
Error22.7
Cost13576
\[\begin{array}{l} t_0 := \sin \left(\pi \cdot \left(angle \cdot 0.011111111111111112\right)\right) \cdot \left(b \cdot b\right)\\ \mathbf{if}\;angle \leq -6.4 \cdot 10^{-9}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;angle \leq 6 \cdot 10^{-5}:\\ \;\;\;\;\left(b + a\right) \cdot \left(0.011111111111111112 \cdot \left(\pi \cdot \left(\left(b - a\right) \cdot angle\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error22.8
Cost13576
\[\begin{array}{l} \mathbf{if}\;angle \leq -6.4 \cdot 10^{-9}:\\ \;\;\;\;\sin \left(0.011111111111111112 \cdot \left(\pi \cdot angle\right)\right) \cdot \left(a \cdot \left(-a\right)\right)\\ \mathbf{elif}\;angle \leq 6 \cdot 10^{-5}:\\ \;\;\;\;\left(b + a\right) \cdot \left(0.011111111111111112 \cdot \left(\pi \cdot \left(\left(b - a\right) \cdot angle\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sin \left(\pi \cdot \left(angle \cdot 0.011111111111111112\right)\right) \cdot \left(b \cdot b\right)\\ \end{array} \]
Alternative 3
Error22.8
Cost13576
\[\begin{array}{l} t_0 := \sin \left(\pi \cdot \left(angle \cdot 0.011111111111111112\right)\right)\\ \mathbf{if}\;angle \leq -6.4 \cdot 10^{-9}:\\ \;\;\;\;t_0 \cdot \left(a \cdot \left(-a\right)\right)\\ \mathbf{elif}\;angle \leq 6 \cdot 10^{-5}:\\ \;\;\;\;\left(b + a\right) \cdot \left(0.011111111111111112 \cdot \left(\pi \cdot \left(\left(b - a\right) \cdot angle\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot \left(b \cdot b\right)\\ \end{array} \]
Alternative 4
Error21.4
Cost13568
\[\left(b + a\right) \cdot \left(\left(b - a\right) \cdot \sin \left(0.011111111111111112 \cdot \left(\pi \cdot angle\right)\right)\right) \]
Alternative 5
Error24.8
Cost7300
\[\begin{array}{l} \mathbf{if}\;angle \leq -2.05 \cdot 10^{+46}:\\ \;\;\;\;angle \cdot \left(\pi \cdot \left(a \cdot \left(a \cdot -0.011111111111111112\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(b + a\right) \cdot \left(0.011111111111111112 \cdot \left(\pi \cdot \left(\left(b - a\right) \cdot angle\right)\right)\right)\\ \end{array} \]
Alternative 6
Error24.7
Cost7300
\[\begin{array}{l} \mathbf{if}\;angle \leq -1.25 \cdot 10^{+57}:\\ \;\;\;\;\left(1 + \left(0.011111111111111112 \cdot \left(b \cdot \pi\right)\right) \cdot \left(b \cdot angle\right)\right) + -1\\ \mathbf{else}:\\ \;\;\;\;\left(b + a\right) \cdot \left(0.011111111111111112 \cdot \left(\pi \cdot \left(\left(b - a\right) \cdot angle\right)\right)\right)\\ \end{array} \]
Alternative 7
Error34.1
Cost7176
\[\begin{array}{l} \mathbf{if}\;b \leq -2.5791758428064726 \cdot 10^{+66}:\\ \;\;\;\;0.011111111111111112 \cdot \left(\pi \cdot \left(b \cdot \left(b \cdot angle\right)\right)\right)\\ \mathbf{elif}\;b \leq 2.6381870900026433 \cdot 10^{-50}:\\ \;\;\;\;angle \cdot \left(\pi \cdot \left(a \cdot \left(a \cdot -0.011111111111111112\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;b \cdot \left(\left(b \cdot angle\right) \cdot \left(\pi \cdot 0.011111111111111112\right)\right)\\ \end{array} \]
Alternative 8
Error32.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 -3.612606902690823 \cdot 10^{-38}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;a \leq 7.3891453365420685 \cdot 10^{+84}:\\ \;\;\;\;0.011111111111111112 \cdot \left(\pi \cdot \left(b \cdot \left(b \cdot angle\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 9
Error43.9
Cost6912
\[angle \cdot \left(0.011111111111111112 \cdot \left(\pi \cdot \left(b \cdot b\right)\right)\right) \]
Alternative 10
Error40.2
Cost6912
\[b \cdot \left(\left(b \cdot angle\right) \cdot \left(\pi \cdot 0.011111111111111112\right)\right) \]
Alternative 11
Error40.3
Cost6912
\[0.011111111111111112 \cdot \left(\pi \cdot \left(b \cdot \left(b \cdot angle\right)\right)\right) \]

Error

Reproduce

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