Average Error: 0.0 → 0.0
Time: 8.3s
Precision: 64
$0.0 \lt x \lt 10$
$\begin{array}{l} \mathbf{if}\;x \cdot x - x \ge 0.0:\\ \;\;\;\;\frac{x}{10}\\ \mathbf{else}:\\ \;\;\;\;x \cdot x + 2\\ \end{array}$
$\begin{array}{l} \mathbf{if}\;x \cdot x - x \ge 0.0:\\ \;\;\;\;\frac{x}{10}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(x \cdot x\right) \cdot \left(x \cdot x\right) - 2 \cdot 2}{x \cdot x - 2}\\ \end{array}$
\begin{array}{l}
\mathbf{if}\;x \cdot x - x \ge 0.0:\\
\;\;\;\;\frac{x}{10}\\

\mathbf{else}:\\
\;\;\;\;x \cdot x + 2\\

\end{array}
\begin{array}{l}
\mathbf{if}\;x \cdot x - x \ge 0.0:\\
\;\;\;\;\frac{x}{10}\\

\mathbf{else}:\\
\;\;\;\;\frac{\left(x \cdot x\right) \cdot \left(x \cdot x\right) - 2 \cdot 2}{x \cdot x - 2}\\

\end{array}
double f(double x) {
double r16637241 = x;
double r16637242 = r16637241 * r16637241;
double r16637243 = r16637242 - r16637241;
double r16637244 = 0.0;
bool r16637245 = r16637243 >= r16637244;
double r16637246 = 10.0;
double r16637247 = r16637241 / r16637246;
double r16637248 = 2.0;
double r16637249 = r16637242 + r16637248;
double r16637250 = r16637245 ? r16637247 : r16637249;
return r16637250;
}


double f(double x) {
double r16637251 = x;
double r16637252 = r16637251 * r16637251;
double r16637253 = r16637252 - r16637251;
double r16637254 = 0.0;
bool r16637255 = r16637253 >= r16637254;
double r16637256 = 10.0;
double r16637257 = r16637251 / r16637256;
double r16637258 = r16637252 * r16637252;
double r16637259 = 2.0;
double r16637260 = r16637259 * r16637259;
double r16637261 = r16637258 - r16637260;
double r16637262 = r16637252 - r16637259;
double r16637263 = r16637261 / r16637262;
double r16637264 = r16637255 ? r16637257 : r16637263;
return r16637264;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 0.0

$\begin{array}{l} \mathbf{if}\;x \cdot x - x \ge 0.0:\\ \;\;\;\;\frac{x}{10}\\ \mathbf{else}:\\ \;\;\;\;x \cdot x + 2\\ \end{array}$
2. Using strategy rm
3. Applied flip-+0.0

$\leadsto \begin{array}{l} \mathbf{if}\;x \cdot x - x \ge 0.0:\\ \;\;\;\;\frac{x}{10}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(x \cdot x\right) \cdot \left(x \cdot x\right) - 2 \cdot 2}{x \cdot x - 2}\\ \end{array}$
4. Final simplification0.0

$\leadsto \begin{array}{l} \mathbf{if}\;x \cdot x - x \ge 0.0:\\ \;\;\;\;\frac{x}{10}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(x \cdot x\right) \cdot \left(x \cdot x\right) - 2 \cdot 2}{x \cdot x - 2}\\ \end{array}$

# Reproduce

herbie shell --seed 1
(FPCore (x)
:name "cav10"
:pre (< 0.0 x 10.0)
(if (>= (- (* x x) x) 0.0) (/ x 10.0) (+ (* x x) 2.0)))