Average Error: 31.5 → 21.2
Time: 11.0s
Precision: binary64
\[\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 := 0.005555555555555556 \cdot \left(angle \cdot \pi\right)\\ -2 \cdot \left(\cos t_0 \cdot \left(\left(a + b\right) \cdot \left(\left(a - b\right) \cdot \sin t_0\right)\right)\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 (* 0.005555555555555556 (* angle PI))))
   (* -2.0 (* (cos t_0) (* (+ a b) (* (- a b) (sin t_0)))))))
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 = 0.005555555555555556 * (angle * ((double) M_PI));
	return -2.0 * (cos(t_0) * ((a + b) * ((a - b) * sin(t_0))));
}
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 = 0.005555555555555556 * (angle * Math.PI);
	return -2.0 * (Math.cos(t_0) * ((a + b) * ((a - b) * Math.sin(t_0))));
}
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 = 0.005555555555555556 * (angle * math.pi)
	return -2.0 * (math.cos(t_0) * ((a + b) * ((a - b) * math.sin(t_0))))
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(0.005555555555555556 * Float64(angle * pi))
	return Float64(-2.0 * Float64(cos(t_0) * Float64(Float64(a + b) * Float64(Float64(a - b) * sin(t_0)))))
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 = 0.005555555555555556 * (angle * pi);
	tmp = -2.0 * (cos(t_0) * ((a + b) * ((a - b) * sin(t_0))));
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[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]}, N[(-2.0 * N[(N[Cos[t$95$0], $MachinePrecision] * N[(N[(a + b), $MachinePrecision] * N[(N[(a - b), $MachinePrecision] * N[Sin[t$95$0], $MachinePrecision]), $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)
\begin{array}{l}
t_0 := 0.005555555555555556 \cdot \left(angle \cdot \pi\right)\\
-2 \cdot \left(\cos t_0 \cdot \left(\left(a + b\right) \cdot \left(\left(a - b\right) \cdot \sin t_0\right)\right)\right)
\end{array}

Error

Bits error versus a

Bits error versus b

Bits error versus angle

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}{\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \left(\left(-2 \cdot \left(a \cdot a - b \cdot b\right)\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)} \]
  3. Applied egg-rr31.5

    \[\leadsto \color{blue}{{\left(\left(\left(a + b\right) \cdot \left(\left(a - b\right) \cdot -2\right)\right) \cdot \left(\cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right) \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\right)}^{1}} \]
  4. Taylor expanded in angle around inf 21.2

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

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

Reproduce

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