(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 (* angle (* PI 0.005555555555555556)))
(t_1 (* 0.005555555555555556 (* PI angle)))
(t_2 (* PI (/ angle 180.0)))
(t_3 (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) (sin t_2)) (cos t_2))))
(if (<= t_3 (- INFINITY))
(*
2.0
(*
b
(*
(fma (pow PI 2.0) (* -1.54320987654321e-5 (* angle angle)) 1.0)
(* b (sin t_0)))))
(if (<= t_3 2e+301)
(* -2.0 (* (- (pow a 2.0) (pow b 2.0)) (* (cos t_1) (sin t_1))))
(*
2.0
(* b (* (cos t_0) (* 0.005555555555555556 (* angle (* b PI))))))))))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 = angle * (((double) M_PI) * 0.005555555555555556);
double t_1 = 0.005555555555555556 * (((double) M_PI) * angle);
double t_2 = ((double) M_PI) * (angle / 180.0);
double t_3 = ((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * sin(t_2)) * cos(t_2);
double tmp;
if (t_3 <= -((double) INFINITY)) {
tmp = 2.0 * (b * (fma(pow(((double) M_PI), 2.0), (-1.54320987654321e-5 * (angle * angle)), 1.0) * (b * sin(t_0))));
} else if (t_3 <= 2e+301) {
tmp = -2.0 * ((pow(a, 2.0) - pow(b, 2.0)) * (cos(t_1) * sin(t_1)));
} else {
tmp = 2.0 * (b * (cos(t_0) * (0.005555555555555556 * (angle * (b * ((double) M_PI))))));
}
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(angle * Float64(pi * 0.005555555555555556)) t_1 = Float64(0.005555555555555556 * Float64(pi * angle)) t_2 = Float64(pi * Float64(angle / 180.0)) t_3 = Float64(Float64(Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) * sin(t_2)) * cos(t_2)) tmp = 0.0 if (t_3 <= Float64(-Inf)) tmp = Float64(2.0 * Float64(b * Float64(fma((pi ^ 2.0), Float64(-1.54320987654321e-5 * Float64(angle * angle)), 1.0) * Float64(b * sin(t_0))))); elseif (t_3 <= 2e+301) tmp = Float64(-2.0 * Float64(Float64((a ^ 2.0) - (b ^ 2.0)) * Float64(cos(t_1) * sin(t_1)))); else tmp = Float64(2.0 * Float64(b * Float64(cos(t_0) * Float64(0.005555555555555556 * Float64(angle * Float64(b * pi)))))); end return 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[(angle * N[(Pi * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.005555555555555556 * N[(Pi * angle), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(2.0 * N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$2], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, (-Infinity)], N[(2.0 * N[(b * N[(N[(N[Power[Pi, 2.0], $MachinePrecision] * N[(-1.54320987654321e-5 * N[(angle * angle), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 2e+301], N[(-2.0 * N[(N[(N[Power[a, 2.0], $MachinePrecision] - N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision] * N[(N[Cos[t$95$1], $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(b * N[(N[Cos[t$95$0], $MachinePrecision] * N[(0.005555555555555556 * N[(angle * N[(b * Pi), $MachinePrecision]), $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 := angle \cdot \left(\pi \cdot 0.005555555555555556\right)\\
t_1 := 0.005555555555555556 \cdot \left(\pi \cdot angle\right)\\
t_2 := \pi \cdot \frac{angle}{180}\\
t_3 := \left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin t_2\right) \cdot \cos t_2\\
\mathbf{if}\;t_3 \leq -\infty:\\
\;\;\;\;2 \cdot \left(b \cdot \left(\mathsf{fma}\left({\pi}^{2}, -1.54320987654321 \cdot 10^{-5} \cdot \left(angle \cdot angle\right), 1\right) \cdot \left(b \cdot \sin t_0\right)\right)\right)\\
\mathbf{elif}\;t_3 \leq 2 \cdot 10^{+301}:\\
\;\;\;\;-2 \cdot \left(\left({a}^{2} - {b}^{2}\right) \cdot \left(\cos t_1 \cdot \sin t_1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(b \cdot \left(\cos t_0 \cdot \left(0.005555555555555556 \cdot \left(angle \cdot \left(b \cdot \pi\right)\right)\right)\right)\right)\\
\end{array}



Bits error versus a



Bits error versus b



Bits error versus angle
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)))) < -inf.0Initial program 64.0
Simplified64.0
Applied egg-rr64.0
Taylor expanded in a around 0 63.3
Simplified31.5
Taylor expanded in angle around 0 31.6
Simplified31.6
if -inf.0 < (*.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)))) < 2.00000000000000011e301Initial program 25.1
Simplified25.1
Taylor expanded in angle around inf 25.1
if 2.00000000000000011e301 < (*.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)))) Initial program 63.8
Simplified63.8
Applied egg-rr63.8
Taylor expanded in a around 0 63.3
Simplified33.8
Taylor expanded in angle around 0 34.0
Final simplification26.4
herbie shell --seed 2022170
(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)))))