Average Error: 47.0 → 45.2
Time: 35.9s
Precision: 64
${\left(\sin \left(\frac{\frac{\left(a - b\right) \cdot \pi}{180}}{2}\right)\right)}^{2} + \left(\cos \left(\frac{y \cdot \pi}{180}\right) \cdot \cos \left(\frac{y \cdot pi}{180}\right)\right) \cdot {\left(\sin \left(\frac{\frac{\left(a - b\right) \cdot \pi}{180}}{2}\right)\right)}^{2}$
${\left(\sin \left(\frac{\frac{\left(a - b\right) \cdot \pi}{180}}{2}\right)\right)}^{2} + {\left(\sin \left(\frac{\frac{\left(a - b\right) \cdot \pi}{180}}{2}\right)\right)}^{2} \cdot \cos \left(0.005555555555555555767577313730498644872569 \cdot \left(y \cdot \pi\right)\right)$
{\left(\sin \left(\frac{\frac{\left(a - b\right) \cdot \pi}{180}}{2}\right)\right)}^{2} + \left(\cos \left(\frac{y \cdot \pi}{180}\right) \cdot \cos \left(\frac{y \cdot pi}{180}\right)\right) \cdot {\left(\sin \left(\frac{\frac{\left(a - b\right) \cdot \pi}{180}}{2}\right)\right)}^{2}
{\left(\sin \left(\frac{\frac{\left(a - b\right) \cdot \pi}{180}}{2}\right)\right)}^{2} + {\left(\sin \left(\frac{\frac{\left(a - b\right) \cdot \pi}{180}}{2}\right)\right)}^{2} \cdot \cos \left(0.005555555555555555767577313730498644872569 \cdot \left(y \cdot \pi\right)\right)
double f(double a, double b, double y, double pi) {
double r946017 = a;
double r946018 = b;
double r946019 = r946017 - r946018;
double r946020 = atan2(1.0, 0.0);
double r946021 = r946019 * r946020;
double r946022 = 180.0;
double r946023 = r946021 / r946022;
double r946024 = 2.0;
double r946025 = r946023 / r946024;
double r946026 = sin(r946025);
double r946027 = pow(r946026, r946024);
double r946028 = y;
double r946029 = r946028 * r946020;
double r946030 = r946029 / r946022;
double r946031 = cos(r946030);
double r946032 = pi;
double r946033 = r946028 * r946032;
double r946034 = r946033 / r946022;
double r946035 = cos(r946034);
double r946036 = r946031 * r946035;
double r946037 = r946036 * r946027;
double r946038 = r946027 + r946037;
return r946038;
}


double f(double a, double b, double y, double __attribute__((unused)) pi) {
double r946039 = a;
double r946040 = b;
double r946041 = r946039 - r946040;
double r946042 = atan2(1.0, 0.0);
double r946043 = r946041 * r946042;
double r946044 = 180.0;
double r946045 = r946043 / r946044;
double r946046 = 2.0;
double r946047 = r946045 / r946046;
double r946048 = sin(r946047);
double r946049 = pow(r946048, r946046);
double r946050 = 0.005555555555555556;
double r946051 = y;
double r946052 = r946051 * r946042;
double r946053 = r946050 * r946052;
double r946054 = cos(r946053);
double r946055 = r946049 * r946054;
double r946056 = r946049 + r946055;
return r946056;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 47.0

${\left(\sin \left(\frac{\frac{\left(a - b\right) \cdot \pi}{180}}{2}\right)\right)}^{2} + \left(\cos \left(\frac{y \cdot \pi}{180}\right) \cdot \cos \left(\frac{y \cdot pi}{180}\right)\right) \cdot {\left(\sin \left(\frac{\frac{\left(a - b\right) \cdot \pi}{180}}{2}\right)\right)}^{2}$
2. Taylor expanded around 0 45.3

$\leadsto {\left(\sin \left(\frac{\frac{\left(a - b\right) \cdot \pi}{180}}{2}\right)\right)}^{2} + \left(\cos \left(\frac{y \cdot \pi}{180}\right) \cdot \color{blue}{1}\right) \cdot {\left(\sin \left(\frac{\frac{\left(a - b\right) \cdot \pi}{180}}{2}\right)\right)}^{2}$
3. Taylor expanded around inf 45.2

$\leadsto {\left(\sin \left(\frac{\frac{\left(a - b\right) \cdot \pi}{180}}{2}\right)\right)}^{2} + \left(\color{blue}{\cos \left(0.005555555555555555767577313730498644872569 \cdot \left(y \cdot \pi\right)\right)} \cdot 1\right) \cdot {\left(\sin \left(\frac{\frac{\left(a - b\right) \cdot \pi}{180}}{2}\right)\right)}^{2}$
4. Final simplification45.2

$\leadsto {\left(\sin \left(\frac{\frac{\left(a - b\right) \cdot \pi}{180}}{2}\right)\right)}^{2} + {\left(\sin \left(\frac{\frac{\left(a - b\right) \cdot \pi}{180}}{2}\right)\right)}^{2} \cdot \cos \left(0.005555555555555555767577313730498644872569 \cdot \left(y \cdot \pi\right)\right)$

# Reproduce

herbie shell --seed 1
(FPCore (a b y pi)
:name "pow(sin((a-b)*PI/180/2), 2) + cos(y*PI/180) * cos(y*pi/180) * pow(sin((a-b)*PI/180/2), 2)"
:precision binary64
(+ (pow (sin (/ (/ (* (- a b) PI) 180) 2)) 2) (* (* (cos (/ (* y PI) 180)) (cos (/ (* y pi) 180))) (pow (sin (/ (/ (* (- a b) PI) 180) 2)) 2))))