Average Error: 9.8 → 0.8
Time: 6.6s
Precision: 64
$100 \cdot \left(\sin x - x\right)$
$\begin{array}{l} \mathbf{if}\;\sin x - x \le -11427567992489.953125 \lor \neg \left(\sin x - x \le 6.352649526211728847613358084345236420631 \cdot 10^{-14}\right):\\ \;\;\;\;\sin x \cdot 100 + 100 \cdot \left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \left(\frac{1}{120} \cdot {x}^{5} - \left(\frac{1}{5040} \cdot {x}^{7} + \frac{1}{6} \cdot {x}^{3}\right)\right)\\ \end{array}$
100 \cdot \left(\sin x - x\right)
\begin{array}{l}
\mathbf{if}\;\sin x - x \le -11427567992489.953125 \lor \neg \left(\sin x - x \le 6.352649526211728847613358084345236420631 \cdot 10^{-14}\right):\\
\;\;\;\;\sin x \cdot 100 + 100 \cdot \left(-x\right)\\

\mathbf{else}:\\
\;\;\;\;100 \cdot \left(\frac{1}{120} \cdot {x}^{5} - \left(\frac{1}{5040} \cdot {x}^{7} + \frac{1}{6} \cdot {x}^{3}\right)\right)\\

\end{array}
double f(double x) {
double r623718 = 100.0;
double r623719 = x;
double r623720 = sin(r623719);
double r623721 = r623720 - r623719;
double r623722 = r623718 * r623721;
return r623722;
}


double f(double x) {
double r623723 = x;
double r623724 = sin(r623723);
double r623725 = r623724 - r623723;
double r623726 = -11427567992489.953;
bool r623727 = r623725 <= r623726;
double r623728 = 6.352649526211729e-14;
bool r623729 = r623725 <= r623728;
double r623730 = !r623729;
bool r623731 = r623727 || r623730;
double r623732 = 100.0;
double r623733 = r623724 * r623732;
double r623734 = -r623723;
double r623735 = r623732 * r623734;
double r623736 = r623733 + r623735;
double r623737 = 0.008333333333333333;
double r623738 = 5.0;
double r623739 = pow(r623723, r623738);
double r623740 = r623737 * r623739;
double r623741 = 0.0001984126984126984;
double r623742 = 7.0;
double r623743 = pow(r623723, r623742);
double r623744 = r623741 * r623743;
double r623745 = 0.16666666666666666;
double r623746 = 3.0;
double r623747 = pow(r623723, r623746);
double r623748 = r623745 * r623747;
double r623749 = r623744 + r623748;
double r623750 = r623740 - r623749;
double r623751 = r623732 * r623750;
double r623752 = r623731 ? r623736 : r623751;
return r623752;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Split input into 2 regimes
2. ## if (- (sin x) x) < -11427567992489.953 or 6.352649526211729e-14 < (- (sin x) x)

1. Initial program 0.1

$100 \cdot \left(\sin x - x\right)$
2. Using strategy rm
3. Applied sub-neg0.1

$\leadsto 100 \cdot \color{blue}{\left(\sin x + \left(-x\right)\right)}$
4. Applied distribute-lft-in0.1

$\leadsto \color{blue}{100 \cdot \sin x + 100 \cdot \left(-x\right)}$
5. Simplified0.1

$\leadsto \color{blue}{\sin x \cdot 100} + 100 \cdot \left(-x\right)$

## if -11427567992489.953 < (- (sin x) x) < 6.352649526211729e-14

1. Initial program 19.3

$100 \cdot \left(\sin x - x\right)$
2. Taylor expanded around 0 1.5

$\leadsto 100 \cdot \color{blue}{\left(\frac{1}{120} \cdot {x}^{5} - \left(\frac{1}{5040} \cdot {x}^{7} + \frac{1}{6} \cdot {x}^{3}\right)\right)}$
3. Recombined 2 regimes into one program.
4. Final simplification0.8

$\leadsto \begin{array}{l} \mathbf{if}\;\sin x - x \le -11427567992489.953125 \lor \neg \left(\sin x - x \le 6.352649526211728847613358084345236420631 \cdot 10^{-14}\right):\\ \;\;\;\;\sin x \cdot 100 + 100 \cdot \left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \left(\frac{1}{120} \cdot {x}^{5} - \left(\frac{1}{5040} \cdot {x}^{7} + \frac{1}{6} \cdot {x}^{3}\right)\right)\\ \end{array}$

# Reproduce

herbie shell --seed 1
(FPCore (x)
:name "100*(sin(x)-x)"
:precision binary64
(* 100 (- (sin x) x)))