Average Error: 31.8 → 29.6
Time: 13.2s
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 := 2 \cdot \left({b}^{2} - {a}^{2}\right)\\ t_1 := \pi \cdot \frac{angle}{180}\\ t_2 := \cos t_1\\ \mathbf{if}\;\left(t_0 \cdot \sin t_1\right) \cdot t_2 \leq 6.234367976340108 \cdot 10^{+243}:\\ \;\;\;\;t_2 \cdot \left(t_0 \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;{\left(\mathsf{hypot}\left(b, a\right) \cdot \sqrt{2 \cdot \sin \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)}\right)}^{2} \cdot \sqrt{{\cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)}^{2}}\\ \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 (* 2.0 (- (pow b 2.0) (pow a 2.0))))
        (t_1 (* PI (/ angle 180.0)))
        (t_2 (cos t_1)))
   (if (<= (* (* t_0 (sin t_1)) t_2) 6.234367976340108e+243)
     (* t_2 (* t_0 (sin (* angle (* PI 0.005555555555555556)))))
     (*
      (pow
       (*
        (hypot b a)
        (sqrt (* 2.0 (sin (* 0.005555555555555556 (* PI angle))))))
       2.0)
      (sqrt (pow (cos (* PI (* angle 0.005555555555555556))) 2.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 = 2.0 * (pow(b, 2.0) - pow(a, 2.0));
	double t_1 = ((double) M_PI) * (angle / 180.0);
	double t_2 = cos(t_1);
	double tmp;
	if (((t_0 * sin(t_1)) * t_2) <= 6.234367976340108e+243) {
		tmp = t_2 * (t_0 * sin((angle * (((double) M_PI) * 0.005555555555555556))));
	} else {
		tmp = pow((hypot(b, a) * sqrt((2.0 * sin((0.005555555555555556 * (((double) M_PI) * angle)))))), 2.0) * sqrt(pow(cos((((double) M_PI) * (angle * 0.005555555555555556))), 2.0));
	}
	return tmp;
}
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 = 2.0 * (Math.pow(b, 2.0) - Math.pow(a, 2.0));
	double t_1 = Math.PI * (angle / 180.0);
	double t_2 = Math.cos(t_1);
	double tmp;
	if (((t_0 * Math.sin(t_1)) * t_2) <= 6.234367976340108e+243) {
		tmp = t_2 * (t_0 * Math.sin((angle * (Math.PI * 0.005555555555555556))));
	} else {
		tmp = Math.pow((Math.hypot(b, a) * Math.sqrt((2.0 * Math.sin((0.005555555555555556 * (Math.PI * angle)))))), 2.0) * Math.sqrt(Math.pow(Math.cos((Math.PI * (angle * 0.005555555555555556))), 2.0));
	}
	return tmp;
}
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 = 2.0 * (math.pow(b, 2.0) - math.pow(a, 2.0))
	t_1 = math.pi * (angle / 180.0)
	t_2 = math.cos(t_1)
	tmp = 0
	if ((t_0 * math.sin(t_1)) * t_2) <= 6.234367976340108e+243:
		tmp = t_2 * (t_0 * math.sin((angle * (math.pi * 0.005555555555555556))))
	else:
		tmp = math.pow((math.hypot(b, a) * math.sqrt((2.0 * math.sin((0.005555555555555556 * (math.pi * angle)))))), 2.0) * math.sqrt(math.pow(math.cos((math.pi * (angle * 0.005555555555555556))), 2.0))
	return tmp
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(2.0 * Float64((b ^ 2.0) - (a ^ 2.0)))
	t_1 = Float64(pi * Float64(angle / 180.0))
	t_2 = cos(t_1)
	tmp = 0.0
	if (Float64(Float64(t_0 * sin(t_1)) * t_2) <= 6.234367976340108e+243)
		tmp = Float64(t_2 * Float64(t_0 * sin(Float64(angle * Float64(pi * 0.005555555555555556)))));
	else
		tmp = Float64((Float64(hypot(b, a) * sqrt(Float64(2.0 * sin(Float64(0.005555555555555556 * Float64(pi * angle)))))) ^ 2.0) * sqrt((cos(Float64(pi * Float64(angle * 0.005555555555555556))) ^ 2.0)));
	end
	return tmp
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_2 = code(a, b, angle)
	t_0 = 2.0 * ((b ^ 2.0) - (a ^ 2.0));
	t_1 = pi * (angle / 180.0);
	t_2 = cos(t_1);
	tmp = 0.0;
	if (((t_0 * sin(t_1)) * t_2) <= 6.234367976340108e+243)
		tmp = t_2 * (t_0 * sin((angle * (pi * 0.005555555555555556))));
	else
		tmp = ((hypot(b, a) * sqrt((2.0 * sin((0.005555555555555556 * (pi * angle)))))) ^ 2.0) * sqrt((cos((pi * (angle * 0.005555555555555556))) ^ 2.0));
	end
	tmp_2 = tmp;
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[(2.0 * N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Cos[t$95$1], $MachinePrecision]}, If[LessEqual[N[(N[(t$95$0 * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision], 6.234367976340108e+243], N[(t$95$2 * N[(t$95$0 * N[Sin[N[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(N[Sqrt[b ^ 2 + a ^ 2], $MachinePrecision] * N[Sqrt[N[(2.0 * N[Sin[N[(0.005555555555555556 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[Sqrt[N[Power[N[Cos[N[(Pi * N[(angle * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $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 := 2 \cdot \left({b}^{2} - {a}^{2}\right)\\
t_1 := \pi \cdot \frac{angle}{180}\\
t_2 := \cos t_1\\
\mathbf{if}\;\left(t_0 \cdot \sin t_1\right) \cdot t_2 \leq 6.234367976340108 \cdot 10^{+243}:\\
\;\;\;\;t_2 \cdot \left(t_0 \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(b, a\right) \cdot \sqrt{2 \cdot \sin \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)}\right)}^{2} \cdot \sqrt{{\cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)}^{2}}\\


\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. Split input into 2 regimes
  2. if (*.f64 (*.f64 (*.f64 2 (-.f64 (pow.f64 b 2) (pow.f64 a 2))) (sin.f64 (*.f64 (PI.f64) (/.f64 angle 180)))) (cos.f64 (*.f64 (PI.f64) (/.f64 angle 180)))) < 6.2343679763401081e243

    1. Initial program 27.9

      \[\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. Taylor expanded in angle around inf 27.9

      \[\leadsto \left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \color{blue}{\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right) \]
    3. Simplified27.8

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

    if 6.2343679763401081e243 < (*.f64 (*.f64 (*.f64 2 (-.f64 (pow.f64 b 2) (pow.f64 a 2))) (sin.f64 (*.f64 (PI.f64) (/.f64 angle 180)))) (cos.f64 (*.f64 (PI.f64) (/.f64 angle 180))))

    1. Initial program 60.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-rr60.4

      \[\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}{\sqrt{{\cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)}^{2}}} \]
    3. Applied egg-rr60.3

      \[\leadsto \color{blue}{{\left(\mathsf{fma}\left(b, b, a \cdot \left(-a\right)\right) \cdot \left(2 \cdot \sin \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\right)}^{1}} \cdot \sqrt{{\cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)}^{2}} \]
    4. Applied egg-rr42.6

      \[\leadsto {\color{blue}{\left({\left(\mathsf{hypot}\left(b, a\right) \cdot \sqrt{\sin \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right) \cdot 2}\right)}^{2}\right)}}^{1} \cdot \sqrt{{\cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)}^{2}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification29.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;\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) \leq 6.234367976340108 \cdot 10^{+243}:\\ \;\;\;\;\cos \left(\pi \cdot \frac{angle}{180}\right) \cdot \left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(angle \cdot \left(\pi \cdot 0.005555555555555556\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;{\left(\mathsf{hypot}\left(b, a\right) \cdot \sqrt{2 \cdot \sin \left(0.005555555555555556 \cdot \left(\pi \cdot angle\right)\right)}\right)}^{2} \cdot \sqrt{{\cos \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)}^{2}}\\ \end{array} \]

Reproduce

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