Average Error: 53.5 → 29.7
Time: 38.2s
Precision: 64
$\frac{\left(1 - {x}^{2}\right) - \cos x}{{x}^{4}} - \frac{3 \cdot \left(\left(x - \sin x\right) - \frac{{x}^{3}}{6}\right)}{{x}^{5}}$
$\begin{array}{l} \mathbf{if}\;x \le -157056352.29531753:\\ \;\;\;\;\frac{\frac{\left(1 - \cos x\right) - x \cdot x}{x \cdot x}}{{x}^{2}} - \left(\frac{3}{\left(x \cdot x\right) \cdot \left(x \cdot x\right)} - \left(\frac{3 \cdot \sin x}{{x}^{5}} + \frac{\frac{1}{2}}{x \cdot x}\right)\right)\\ \mathbf{elif}\;x \le -1.8897870863774397 \cdot 10^{-65}:\\ \;\;\;\;\frac{\frac{\left(1 - \cos x\right) - x \cdot x}{x \cdot x}}{{x}^{2}} - \frac{3 \cdot \left(\left(x - \sin x\right) - \frac{{x}^{3}}{6}\right)}{{x}^{5}}\\ \mathbf{elif}\;x \le 7.644387559412944 \cdot 10^{-124}:\\ \;\;\;\;\frac{\frac{\left(1 - \cos x\right) - x \cdot x}{x \cdot x}}{{x}^{2}} - \left(\frac{1}{1680} \cdot \left(x \cdot x\right) - \left(\left(\frac{1}{120960} \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + \frac{1}{40}\right)\right)\\ \mathbf{elif}\;x \le 2.2627032819018833:\\ \;\;\;\;\frac{\frac{\left(1 - \cos x\right) - x \cdot x}{x \cdot x}}{{x}^{2}} - \frac{\left(x - \sin x\right) - \frac{{x}^{3}}{6}}{{x}^{\frac{5}{2}}} \cdot \frac{3}{{x}^{\frac{5}{2}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\left(1 - \cos x\right) - x \cdot x}{x \cdot x}}{{x}^{2}} - \left(\frac{3}{\left(x \cdot x\right) \cdot \left(x \cdot x\right)} - \left(\frac{3 \cdot \sin x}{{x}^{5}} + \frac{\frac{1}{2}}{x \cdot x}\right)\right)\\ \end{array}$
\frac{\left(1 - {x}^{2}\right) - \cos x}{{x}^{4}} - \frac{3 \cdot \left(\left(x - \sin x\right) - \frac{{x}^{3}}{6}\right)}{{x}^{5}}
\begin{array}{l}
\mathbf{if}\;x \le -157056352.29531753:\\
\;\;\;\;\frac{\frac{\left(1 - \cos x\right) - x \cdot x}{x \cdot x}}{{x}^{2}} - \left(\frac{3}{\left(x \cdot x\right) \cdot \left(x \cdot x\right)} - \left(\frac{3 \cdot \sin x}{{x}^{5}} + \frac{\frac{1}{2}}{x \cdot x}\right)\right)\\

\mathbf{elif}\;x \le -1.8897870863774397 \cdot 10^{-65}:\\
\;\;\;\;\frac{\frac{\left(1 - \cos x\right) - x \cdot x}{x \cdot x}}{{x}^{2}} - \frac{3 \cdot \left(\left(x - \sin x\right) - \frac{{x}^{3}}{6}\right)}{{x}^{5}}\\

\mathbf{elif}\;x \le 7.644387559412944 \cdot 10^{-124}:\\
\;\;\;\;\frac{\frac{\left(1 - \cos x\right) - x \cdot x}{x \cdot x}}{{x}^{2}} - \left(\frac{1}{1680} \cdot \left(x \cdot x\right) - \left(\left(\frac{1}{120960} \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + \frac{1}{40}\right)\right)\\

\mathbf{elif}\;x \le 2.2627032819018833:\\
\;\;\;\;\frac{\frac{\left(1 - \cos x\right) - x \cdot x}{x \cdot x}}{{x}^{2}} - \frac{\left(x - \sin x\right) - \frac{{x}^{3}}{6}}{{x}^{\frac{5}{2}}} \cdot \frac{3}{{x}^{\frac{5}{2}}}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{\left(1 - \cos x\right) - x \cdot x}{x \cdot x}}{{x}^{2}} - \left(\frac{3}{\left(x \cdot x\right) \cdot \left(x \cdot x\right)} - \left(\frac{3 \cdot \sin x}{{x}^{5}} + \frac{\frac{1}{2}}{x \cdot x}\right)\right)\\

\end{array}
double f(double x) {
double r12901282 = 1.0;
double r12901283 = x;
double r12901284 = 2.0;
double r12901285 = pow(r12901283, r12901284);
double r12901286 = r12901282 - r12901285;
double r12901287 = cos(r12901283);
double r12901288 = r12901286 - r12901287;
double r12901289 = 4.0;
double r12901290 = pow(r12901283, r12901289);
double r12901291 = r12901288 / r12901290;
double r12901292 = 3.0;
double r12901293 = sin(r12901283);
double r12901294 = r12901283 - r12901293;
double r12901295 = pow(r12901283, r12901292);
double r12901296 = 6.0;
double r12901297 = r12901295 / r12901296;
double r12901298 = r12901294 - r12901297;
double r12901299 = r12901292 * r12901298;
double r12901300 = 5.0;
double r12901301 = pow(r12901283, r12901300);
double r12901302 = r12901299 / r12901301;
double r12901303 = r12901291 - r12901302;
return r12901303;
}


double f(double x) {
double r12901304 = x;
double r12901305 = -157056352.29531753;
bool r12901306 = r12901304 <= r12901305;
double r12901307 = 1.0;
double r12901308 = cos(r12901304);
double r12901309 = r12901307 - r12901308;
double r12901310 = r12901304 * r12901304;
double r12901311 = r12901309 - r12901310;
double r12901312 = r12901311 / r12901310;
double r12901313 = 2.0;
double r12901314 = pow(r12901304, r12901313);
double r12901315 = r12901312 / r12901314;
double r12901316 = 3.0;
double r12901317 = r12901310 * r12901310;
double r12901318 = r12901316 / r12901317;
double r12901319 = sin(r12901304);
double r12901320 = r12901316 * r12901319;
double r12901321 = 5.0;
double r12901322 = pow(r12901304, r12901321);
double r12901323 = r12901320 / r12901322;
double r12901324 = 0.5;
double r12901325 = r12901324 / r12901310;
double r12901326 = r12901323 + r12901325;
double r12901327 = r12901318 - r12901326;
double r12901328 = r12901315 - r12901327;
double r12901329 = -1.8897870863774397e-65;
bool r12901330 = r12901304 <= r12901329;
double r12901331 = r12901304 - r12901319;
double r12901332 = pow(r12901304, r12901316);
double r12901333 = 6.0;
double r12901334 = r12901332 / r12901333;
double r12901335 = r12901331 - r12901334;
double r12901336 = r12901316 * r12901335;
double r12901337 = r12901336 / r12901322;
double r12901338 = r12901315 - r12901337;
double r12901339 = 7.644387559412944e-124;
bool r12901340 = r12901304 <= r12901339;
double r12901341 = 0.0005952380952380953;
double r12901342 = r12901341 * r12901310;
double r12901343 = 8.267195767195768e-06;
double r12901344 = r12901343 * r12901310;
double r12901345 = r12901344 * r12901310;
double r12901346 = 0.025;
double r12901347 = r12901345 + r12901346;
double r12901348 = r12901342 - r12901347;
double r12901349 = r12901315 - r12901348;
double r12901350 = 2.2627032819018833;
bool r12901351 = r12901304 <= r12901350;
double r12901352 = 2.5;
double r12901353 = pow(r12901304, r12901352);
double r12901354 = r12901335 / r12901353;
double r12901355 = r12901316 / r12901353;
double r12901356 = r12901354 * r12901355;
double r12901357 = r12901315 - r12901356;
double r12901358 = r12901351 ? r12901357 : r12901328;
double r12901359 = r12901340 ? r12901349 : r12901358;
double r12901360 = r12901330 ? r12901338 : r12901359;
double r12901361 = r12901306 ? r12901328 : r12901360;
return r12901361;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Split input into 4 regimes
2. ## if x < -157056352.29531753 or 2.2627032819018833 < x

1. Initial program 50.4

$\frac{\left(1 - {x}^{2}\right) - \cos x}{{x}^{4}} - \frac{3 \cdot \left(\left(x - \sin x\right) - \frac{{x}^{3}}{6}\right)}{{x}^{5}}$
2. Using strategy rm
3. Applied sqr-pow50.4

$\leadsto \frac{\left(1 - {x}^{2}\right) - \cos x}{\color{blue}{{x}^{\left(\frac{4}{2}\right)} \cdot {x}^{\left(\frac{4}{2}\right)}}} - \frac{3 \cdot \left(\left(x - \sin x\right) - \frac{{x}^{3}}{6}\right)}{{x}^{5}}$
4. Applied associate-/r*49.7

$\leadsto \color{blue}{\frac{\frac{\left(1 - {x}^{2}\right) - \cos x}{{x}^{\left(\frac{4}{2}\right)}}}{{x}^{\left(\frac{4}{2}\right)}}} - \frac{3 \cdot \left(\left(x - \sin x\right) - \frac{{x}^{3}}{6}\right)}{{x}^{5}}$
5. Simplified49.7

$\leadsto \frac{\color{blue}{\frac{\left(1 - \cos x\right) - x \cdot x}{x \cdot x}}}{{x}^{\left(\frac{4}{2}\right)}} - \frac{3 \cdot \left(\left(x - \sin x\right) - \frac{{x}^{3}}{6}\right)}{{x}^{5}}$
6. Taylor expanded around inf 32.2

$\leadsto \frac{\frac{\left(1 - \cos x\right) - x \cdot x}{x \cdot x}}{{x}^{\left(\frac{4}{2}\right)}} - \color{blue}{\left(3 \cdot \frac{1}{{x}^{4}} - \left(\frac{1}{2} \cdot \frac{1}{{x}^{2}} + 3 \cdot \frac{\sin x}{{x}^{5}}\right)\right)}$
7. Simplified32.2

$\leadsto \frac{\frac{\left(1 - \cos x\right) - x \cdot x}{x \cdot x}}{{x}^{\left(\frac{4}{2}\right)}} - \color{blue}{\left(\frac{3}{\left(x \cdot x\right) \cdot \left(x \cdot x\right)} - \left(\frac{\frac{1}{2}}{x \cdot x} + \frac{\sin x \cdot 3}{{x}^{5}}\right)\right)}$

## if -157056352.29531753 < x < -1.8897870863774397e-65

1. Initial program 50.6

$\frac{\left(1 - {x}^{2}\right) - \cos x}{{x}^{4}} - \frac{3 \cdot \left(\left(x - \sin x\right) - \frac{{x}^{3}}{6}\right)}{{x}^{5}}$
2. Using strategy rm
3. Applied sqr-pow50.6

$\leadsto \frac{\left(1 - {x}^{2}\right) - \cos x}{\color{blue}{{x}^{\left(\frac{4}{2}\right)} \cdot {x}^{\left(\frac{4}{2}\right)}}} - \frac{3 \cdot \left(\left(x - \sin x\right) - \frac{{x}^{3}}{6}\right)}{{x}^{5}}$
4. Applied associate-/r*50.6

$\leadsto \color{blue}{\frac{\frac{\left(1 - {x}^{2}\right) - \cos x}{{x}^{\left(\frac{4}{2}\right)}}}{{x}^{\left(\frac{4}{2}\right)}}} - \frac{3 \cdot \left(\left(x - \sin x\right) - \frac{{x}^{3}}{6}\right)}{{x}^{5}}$
5. Simplified4.9

$\leadsto \frac{\color{blue}{\frac{\left(1 - \cos x\right) - x \cdot x}{x \cdot x}}}{{x}^{\left(\frac{4}{2}\right)}} - \frac{3 \cdot \left(\left(x - \sin x\right) - \frac{{x}^{3}}{6}\right)}{{x}^{5}}$
6. Taylor expanded around inf 4.9

$\leadsto \frac{\frac{\left(1 - \cos x\right) - x \cdot x}{x \cdot x}}{{x}^{\left(\frac{4}{2}\right)}} - \frac{3 \cdot \left(\color{blue}{\left(x - \sin x\right)} - \frac{{x}^{3}}{6}\right)}{{x}^{5}}$

## if -1.8897870863774397e-65 < x < 7.644387559412944e-124

1. Initial program 63.9

$\frac{\left(1 - {x}^{2}\right) - \cos x}{{x}^{4}} - \frac{3 \cdot \left(\left(x - \sin x\right) - \frac{{x}^{3}}{6}\right)}{{x}^{5}}$
2. Using strategy rm
3. Applied sqr-pow63.9

$\leadsto \frac{\left(1 - {x}^{2}\right) - \cos x}{\color{blue}{{x}^{\left(\frac{4}{2}\right)} \cdot {x}^{\left(\frac{4}{2}\right)}}} - \frac{3 \cdot \left(\left(x - \sin x\right) - \frac{{x}^{3}}{6}\right)}{{x}^{5}}$
4. Applied associate-/r*63.9

$\leadsto \color{blue}{\frac{\frac{\left(1 - {x}^{2}\right) - \cos x}{{x}^{\left(\frac{4}{2}\right)}}}{{x}^{\left(\frac{4}{2}\right)}}} - \frac{3 \cdot \left(\left(x - \sin x\right) - \frac{{x}^{3}}{6}\right)}{{x}^{5}}$
5. Simplified63.9

$\leadsto \frac{\color{blue}{\frac{\left(1 - \cos x\right) - x \cdot x}{x \cdot x}}}{{x}^{\left(\frac{4}{2}\right)}} - \frac{3 \cdot \left(\left(x - \sin x\right) - \frac{{x}^{3}}{6}\right)}{{x}^{5}}$
6. Taylor expanded around 0 52.0

$\leadsto \frac{\frac{\left(1 - \cos x\right) - x \cdot x}{x \cdot x}}{{x}^{\left(\frac{4}{2}\right)}} - \color{blue}{\left(\frac{1}{1680} \cdot {x}^{2} - \left(\frac{1}{120960} \cdot {x}^{4} + \frac{1}{40}\right)\right)}$
7. Simplified52.0

$\leadsto \frac{\frac{\left(1 - \cos x\right) - x \cdot x}{x \cdot x}}{{x}^{\left(\frac{4}{2}\right)}} - \color{blue}{\left(\left(x \cdot x\right) \cdot \frac{1}{1680} - \left(\frac{1}{40} + \left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \frac{1}{120960}\right)\right)\right)}$

## if 7.644387559412944e-124 < x < 2.2627032819018833

1. Initial program 60.3

$\frac{\left(1 - {x}^{2}\right) - \cos x}{{x}^{4}} - \frac{3 \cdot \left(\left(x - \sin x\right) - \frac{{x}^{3}}{6}\right)}{{x}^{5}}$
2. Using strategy rm
3. Applied sqr-pow60.3

$\leadsto \frac{\left(1 - {x}^{2}\right) - \cos x}{\color{blue}{{x}^{\left(\frac{4}{2}\right)} \cdot {x}^{\left(\frac{4}{2}\right)}}} - \frac{3 \cdot \left(\left(x - \sin x\right) - \frac{{x}^{3}}{6}\right)}{{x}^{5}}$
4. Applied associate-/r*60.3

$\leadsto \color{blue}{\frac{\frac{\left(1 - {x}^{2}\right) - \cos x}{{x}^{\left(\frac{4}{2}\right)}}}{{x}^{\left(\frac{4}{2}\right)}}} - \frac{3 \cdot \left(\left(x - \sin x\right) - \frac{{x}^{3}}{6}\right)}{{x}^{5}}$
5. Simplified34.8

$\leadsto \frac{\color{blue}{\frac{\left(1 - \cos x\right) - x \cdot x}{x \cdot x}}}{{x}^{\left(\frac{4}{2}\right)}} - \frac{3 \cdot \left(\left(x - \sin x\right) - \frac{{x}^{3}}{6}\right)}{{x}^{5}}$
6. Using strategy rm
7. Applied sqr-pow34.8

$\leadsto \frac{\frac{\left(1 - \cos x\right) - x \cdot x}{x \cdot x}}{{x}^{\left(\frac{4}{2}\right)}} - \frac{3 \cdot \left(\left(x - \sin x\right) - \frac{{x}^{3}}{6}\right)}{\color{blue}{{x}^{\left(\frac{5}{2}\right)} \cdot {x}^{\left(\frac{5}{2}\right)}}}$
8. Applied times-frac10.5

$\leadsto \frac{\frac{\left(1 - \cos x\right) - x \cdot x}{x \cdot x}}{{x}^{\left(\frac{4}{2}\right)}} - \color{blue}{\frac{3}{{x}^{\left(\frac{5}{2}\right)}} \cdot \frac{\left(x - \sin x\right) - \frac{{x}^{3}}{6}}{{x}^{\left(\frac{5}{2}\right)}}}$
3. Recombined 4 regimes into one program.
4. Final simplification29.7

$\leadsto \begin{array}{l} \mathbf{if}\;x \le -157056352.29531753:\\ \;\;\;\;\frac{\frac{\left(1 - \cos x\right) - x \cdot x}{x \cdot x}}{{x}^{2}} - \left(\frac{3}{\left(x \cdot x\right) \cdot \left(x \cdot x\right)} - \left(\frac{3 \cdot \sin x}{{x}^{5}} + \frac{\frac{1}{2}}{x \cdot x}\right)\right)\\ \mathbf{elif}\;x \le -1.8897870863774397 \cdot 10^{-65}:\\ \;\;\;\;\frac{\frac{\left(1 - \cos x\right) - x \cdot x}{x \cdot x}}{{x}^{2}} - \frac{3 \cdot \left(\left(x - \sin x\right) - \frac{{x}^{3}}{6}\right)}{{x}^{5}}\\ \mathbf{elif}\;x \le 7.644387559412944 \cdot 10^{-124}:\\ \;\;\;\;\frac{\frac{\left(1 - \cos x\right) - x \cdot x}{x \cdot x}}{{x}^{2}} - \left(\frac{1}{1680} \cdot \left(x \cdot x\right) - \left(\left(\frac{1}{120960} \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + \frac{1}{40}\right)\right)\\ \mathbf{elif}\;x \le 2.2627032819018833:\\ \;\;\;\;\frac{\frac{\left(1 - \cos x\right) - x \cdot x}{x \cdot x}}{{x}^{2}} - \frac{\left(x - \sin x\right) - \frac{{x}^{3}}{6}}{{x}^{\frac{5}{2}}} \cdot \frac{3}{{x}^{\frac{5}{2}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\left(1 - \cos x\right) - x \cdot x}{x \cdot x}}{{x}^{2}} - \left(\frac{3}{\left(x \cdot x\right) \cdot \left(x \cdot x\right)} - \left(\frac{3 \cdot \sin x}{{x}^{5}} + \frac{\frac{1}{2}}{x \cdot x}\right)\right)\\ \end{array}$

# Reproduce

herbie shell --seed 1
(FPCore (x)
:name "(1-x^2-cos(x))/x^4 - 3*(x-sin(x)-x^3/6)/x^5"
(- (/ (- (- 1 (pow x 2)) (cos x)) (pow x 4)) (/ (* 3 (- (- x (sin x)) (/ (pow x 3) 6))) (pow x 5))))