Average Error: 15.9 → 15.9
Time: 1.3s
Precision: binary64
\[\left(n - x\right) + n \cdot \log \left(\frac{x}{n}\right)\]
\[\left(n - x\right) + n \cdot \log \left(\frac{x}{n}\right)\]
\left(n - x\right) + n \cdot \log \left(\frac{x}{n}\right)
\left(n - x\right) + n \cdot \log \left(\frac{x}{n}\right)
double code(double n, double x) {
	return ((double) (((double) (n - x)) + ((double) (n * ((double) log(((double) (x / n))))))));
}
double code(double n, double x) {
	return ((double) (((double) (n - x)) + ((double) (n * ((double) log(((double) (x / n))))))));
}

Error

Bits error versus n

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 15.9

    \[\left(n - x\right) + n \cdot \log \left(\frac{x}{n}\right)\]
  2. Final simplification15.9

    \[\leadsto \left(n - x\right) + n \cdot \log \left(\frac{x}{n}\right)\]

Reproduce

herbie shell --seed 2020153 
(FPCore (n x)
  :name "(+ (- n x) (* n (log (/ x n))))"
  :precision binary64
  (+ (- n x) (* n (log (/ x n)))))