Average Error: 16.2 → 0.0
Time: 2.3s
Precision: 64
\[\left(\frac{1}{x} - 3 \cdot x\right) + \left(x \cdot x\right) \cdot \frac{1}{x}\]
\[\frac{1}{x} - \left(3 - 1\right) \cdot x\]
\left(\frac{1}{x} - 3 \cdot x\right) + \left(x \cdot x\right) \cdot \frac{1}{x}
\frac{1}{x} - \left(3 - 1\right) \cdot x
double f(double x) {
        double r1868875 = 1.0;
        double r1868876 = x;
        double r1868877 = r1868875 / r1868876;
        double r1868878 = 3.0;
        double r1868879 = r1868878 * r1868876;
        double r1868880 = r1868877 - r1868879;
        double r1868881 = r1868876 * r1868876;
        double r1868882 = r1868881 * r1868877;
        double r1868883 = r1868880 + r1868882;
        return r1868883;
}

double f(double x) {
        double r1868884 = 1.0;
        double r1868885 = x;
        double r1868886 = r1868884 / r1868885;
        double r1868887 = 3.0;
        double r1868888 = r1868887 - r1868884;
        double r1868889 = r1868888 * r1868885;
        double r1868890 = r1868886 - r1868889;
        return r1868890;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 16.2

    \[\left(\frac{1}{x} - 3 \cdot x\right) + \left(x \cdot x\right) \cdot \frac{1}{x}\]
  2. Simplified0.0

    \[\leadsto \color{blue}{\frac{1}{x} - \left(3 - 1\right) \cdot x}\]
  3. Final simplification0.0

    \[\leadsto \frac{1}{x} - \left(3 - 1\right) \cdot x\]

Reproduce

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