Average Error: 9.6 → 0.1
Time: 21.1s
Precision: 64
\[\left(\left(x \cdot x\right) \cdot \left(4 + k \cdot k\right) + x \cdot \left(\left(2 \cdot n\right) \cdot k\right)\right) + \left(\left(-100\right) + n \cdot n\right)\]
\[\left(\left(\left(k \cdot x\right) \cdot \left(k \cdot x\right) + 4 \cdot \left(x \cdot x\right)\right) + n \cdot \left(\left(2 \cdot k\right) \cdot x + n\right)\right) - 100\]
\left(\left(x \cdot x\right) \cdot \left(4 + k \cdot k\right) + x \cdot \left(\left(2 \cdot n\right) \cdot k\right)\right) + \left(\left(-100\right) + n \cdot n\right)
\left(\left(\left(k \cdot x\right) \cdot \left(k \cdot x\right) + 4 \cdot \left(x \cdot x\right)\right) + n \cdot \left(\left(2 \cdot k\right) \cdot x + n\right)\right) - 100
double f(double x, double k, double n) {
        double r5242387 = x;
        double r5242388 = r5242387 * r5242387;
        double r5242389 = 4.0;
        double r5242390 = k;
        double r5242391 = r5242390 * r5242390;
        double r5242392 = r5242389 + r5242391;
        double r5242393 = r5242388 * r5242392;
        double r5242394 = 2.0;
        double r5242395 = n;
        double r5242396 = r5242394 * r5242395;
        double r5242397 = r5242396 * r5242390;
        double r5242398 = r5242387 * r5242397;
        double r5242399 = r5242393 + r5242398;
        double r5242400 = 100.0;
        double r5242401 = -r5242400;
        double r5242402 = r5242395 * r5242395;
        double r5242403 = r5242401 + r5242402;
        double r5242404 = r5242399 + r5242403;
        return r5242404;
}

double f(double x, double k, double n) {
        double r5242405 = k;
        double r5242406 = x;
        double r5242407 = r5242405 * r5242406;
        double r5242408 = r5242407 * r5242407;
        double r5242409 = 4.0;
        double r5242410 = r5242406 * r5242406;
        double r5242411 = r5242409 * r5242410;
        double r5242412 = r5242408 + r5242411;
        double r5242413 = n;
        double r5242414 = 2.0;
        double r5242415 = r5242414 * r5242405;
        double r5242416 = r5242415 * r5242406;
        double r5242417 = r5242416 + r5242413;
        double r5242418 = r5242413 * r5242417;
        double r5242419 = r5242412 + r5242418;
        double r5242420 = 100.0;
        double r5242421 = r5242419 - r5242420;
        return r5242421;
}

Error

Bits error versus x

Bits error versus k

Bits error versus n

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 9.6

    \[\left(\left(x \cdot x\right) \cdot \left(4 + k \cdot k\right) + x \cdot \left(\left(2 \cdot n\right) \cdot k\right)\right) + \left(\left(-100\right) + n \cdot n\right)\]
  2. Simplified9.6

    \[\leadsto \color{blue}{\left(n \cdot \left(\left(k \cdot 2\right) \cdot x + n\right) + \left(x \cdot x\right) \cdot \left(4 + k \cdot k\right)\right) - 100}\]
  3. Using strategy rm
  4. Applied distribute-lft-in9.6

    \[\leadsto \left(n \cdot \left(\left(k \cdot 2\right) \cdot x + n\right) + \color{blue}{\left(\left(x \cdot x\right) \cdot 4 + \left(x \cdot x\right) \cdot \left(k \cdot k\right)\right)}\right) - 100\]
  5. Using strategy rm
  6. Applied unswap-sqr0.1

    \[\leadsto \left(n \cdot \left(\left(k \cdot 2\right) \cdot x + n\right) + \left(\left(x \cdot x\right) \cdot 4 + \color{blue}{\left(x \cdot k\right) \cdot \left(x \cdot k\right)}\right)\right) - 100\]
  7. Final simplification0.1

    \[\leadsto \left(\left(\left(k \cdot x\right) \cdot \left(k \cdot x\right) + 4 \cdot \left(x \cdot x\right)\right) + n \cdot \left(\left(2 \cdot k\right) \cdot x + n\right)\right) - 100\]

Reproduce

herbie shell --seed 1 
(FPCore (x k n)
  :name "x*x*(4+k*k)+x*(2*n*k)+(-100+n*n)"
  (+ (+ (* (* x x) (+ 4.0 (* k k))) (* x (* (* 2.0 n) k))) (+ (- 100.0) (* n n))))