Average Error: 0.2 → 0.2
Time: 11.1s
Precision: 64
$\frac{\left(\left(\left(\left(-f\right) \cdot f\right) \cdot f + \left(3 \cdot f\right) \cdot f\right) - 3 \cdot f\right) + 1}{6}$
$\frac{\left(\left(f \cdot 3 + f \cdot \left(-f\right)\right) - 3\right) \cdot f + 1}{6}$
\frac{\left(\left(\left(\left(-f\right) \cdot f\right) \cdot f + \left(3 \cdot f\right) \cdot f\right) - 3 \cdot f\right) + 1}{6}
\frac{\left(\left(f \cdot 3 + f \cdot \left(-f\right)\right) - 3\right) \cdot f + 1}{6}
double f(double f) {
double r3465205 = f;
double r3465206 = -r3465205;
double r3465207 = r3465206 * r3465205;
double r3465208 = r3465207 * r3465205;
double r3465209 = 3.0;
double r3465210 = r3465209 * r3465205;
double r3465211 = r3465210 * r3465205;
double r3465212 = r3465208 + r3465211;
double r3465213 = r3465212 - r3465210;
double r3465214 = 1.0;
double r3465215 = r3465213 + r3465214;
double r3465216 = 6.0;
double r3465217 = r3465215 / r3465216;
return r3465217;
}


double f(double f) {
double r3465218 = f;
double r3465219 = 3.0;
double r3465220 = r3465218 * r3465219;
double r3465221 = -r3465218;
double r3465222 = r3465218 * r3465221;
double r3465223 = r3465220 + r3465222;
double r3465224 = r3465223 - r3465219;
double r3465225 = r3465224 * r3465218;
double r3465226 = 1.0;
double r3465227 = r3465225 + r3465226;
double r3465228 = 6.0;
double r3465229 = r3465227 / r3465228;
return r3465229;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 0.2

$\frac{\left(\left(\left(\left(-f\right) \cdot f\right) \cdot f + \left(3 \cdot f\right) \cdot f\right) - 3 \cdot f\right) + 1}{6}$
2. Simplified0.2

$\leadsto \color{blue}{\frac{\left(f \cdot \left(3 - f\right) - 3\right) \cdot f + 1}{6}}$
3. Using strategy rm
4. Applied sub-neg0.2

$\leadsto \frac{\left(f \cdot \color{blue}{\left(3 + \left(-f\right)\right)} - 3\right) \cdot f + 1}{6}$
5. Applied distribute-lft-in0.2

$\leadsto \frac{\left(\color{blue}{\left(f \cdot 3 + f \cdot \left(-f\right)\right)} - 3\right) \cdot f + 1}{6}$
6. Final simplification0.2

$\leadsto \frac{\left(\left(f \cdot 3 + f \cdot \left(-f\right)\right) - 3\right) \cdot f + 1}{6}$

# Reproduce

herbie shell --seed 1
(FPCore (f)
:name "(-f*f*f + 3 * f*f - 3 * f + 1) / 6"
:precision binary64
(/ (+ (- (+ (* (* (- f) f) f) (* (* 3 f) f)) (* 3 f)) 1) 6))