(FPCore (a b angle) :precision binary64 (+ (pow (* a (cos (* PI (/ angle 180.0)))) 2.0) (pow (* b (sin (* PI (/ angle 180.0)))) 2.0)))
(FPCore (a b angle)
:precision binary64
(+
(pow a 2.0)
(pow
(*
b
(log1p
(expm1 (sin (* (* PI (/ 1.0 (sqrt 180.0))) (/ angle (sqrt 180.0)))))))
2.0)))double code(double a, double b, double angle) {
return pow((a * cos((((double) M_PI) * (angle / 180.0)))), 2.0) + pow((b * sin((((double) M_PI) * (angle / 180.0)))), 2.0);
}
double code(double a, double b, double angle) {
return pow(a, 2.0) + pow((b * log1p(expm1(sin(((((double) M_PI) * (1.0 / sqrt(180.0))) * (angle / sqrt(180.0))))))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow((a * Math.cos((Math.PI * (angle / 180.0)))), 2.0) + Math.pow((b * Math.sin((Math.PI * (angle / 180.0)))), 2.0);
}
public static double code(double a, double b, double angle) {
return Math.pow(a, 2.0) + Math.pow((b * Math.log1p(Math.expm1(Math.sin(((Math.PI * (1.0 / Math.sqrt(180.0))) * (angle / Math.sqrt(180.0))))))), 2.0);
}
def code(a, b, angle): return math.pow((a * math.cos((math.pi * (angle / 180.0)))), 2.0) + math.pow((b * math.sin((math.pi * (angle / 180.0)))), 2.0)
def code(a, b, angle): return math.pow(a, 2.0) + math.pow((b * math.log1p(math.expm1(math.sin(((math.pi * (1.0 / math.sqrt(180.0))) * (angle / math.sqrt(180.0))))))), 2.0)
function code(a, b, angle) return Float64((Float64(a * cos(Float64(pi * Float64(angle / 180.0)))) ^ 2.0) + (Float64(b * sin(Float64(pi * Float64(angle / 180.0)))) ^ 2.0)) end
function code(a, b, angle) return Float64((a ^ 2.0) + (Float64(b * log1p(expm1(sin(Float64(Float64(pi * Float64(1.0 / sqrt(180.0))) * Float64(angle / sqrt(180.0))))))) ^ 2.0)) end
code[a_, b_, angle_] := N[(N[Power[N[(a * N[Cos[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
code[a_, b_, angle_] := N[(N[Power[a, 2.0], $MachinePrecision] + N[Power[N[(b * N[Log[1 + N[(Exp[N[Sin[N[(N[(Pi * N[(1.0 / N[Sqrt[180.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(angle / N[Sqrt[180.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
{\left(a \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right)}^{2}
{a}^{2} + {\left(b \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\sin \left(\left(\pi \cdot \frac{1}{\sqrt{180}}\right) \cdot \frac{angle}{\sqrt{180}}\right)\right)\right)\right)}^{2}



Bits error versus a



Bits error versus b



Bits error versus angle
Results
Initial program 20.3
Taylor expanded in angle around 0 20.3
Applied add-sqr-sqrt_binary6420.5
Applied *-un-lft-identity_binary6420.5
Applied times-frac_binary6420.4
Applied associate-*r*_binary6420.3
Applied log1p-expm1-u_binary6420.3
Final simplification20.3
herbie shell --seed 2022129
(FPCore (a b angle)
:name "ab-angle->ABCF C"
:precision binary64
(+ (pow (* a (cos (* PI (/ angle 180.0)))) 2.0) (pow (* b (sin (* PI (/ angle 180.0)))) 2.0)))