Average Error: 0.3 → 0.3
Time: 2.0s
Precision: binary64
\[x \cdot \log x\]
\[-x \cdot \log \left(\frac{1}{x}\right)\]
x \cdot \log x
-x \cdot \log \left(\frac{1}{x}\right)
(FPCore (x) :precision binary64 (* x (log x)))
(FPCore (x) :precision binary64 (- (* x (log (/ 1.0 x)))))
double code(double x) {
	return x * log(x);
}
double code(double x) {
	return -(x * log(1.0 / x));
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.3

    \[x \cdot \log x\]
  2. Taylor expanded around inf 0.3

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

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

Alternatives

Reproduce

herbie shell --seed 2021118 
(FPCore (x)
  :name "Statistics.Distribution.Binomial:directEntropy from math-functions-0.1.5.2"
  :precision binary64
  (* x (log x)))