Average Error: 0.2 → 0.1
Time: 1.1s
Precision: binary64
\[\frac{x \cdot \log 2 - i}{\log 2}\]
\[x - \frac{i}{\log 2}\]
\frac{x \cdot \log 2 - i}{\log 2}
x - \frac{i}{\log 2}
double code(double x, double i) {
	return ((double) (((double) (((double) (x * ((double) log(2.0)))) - i)) / ((double) log(2.0))));
}
double code(double x, double i) {
	return ((double) (x - ((double) (i / ((double) log(2.0))))));
}

Error

Bits error versus x

Bits error versus i

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.2

    \[\frac{x \cdot \log 2 - i}{\log 2}\]
  2. Simplified0.1

    \[\leadsto \color{blue}{x - \frac{i}{\log 2}}\]
  3. Final simplification0.1

    \[\leadsto x - \frac{i}{\log 2}\]

Reproduce

herbie shell --seed 2020153 
(FPCore (x i)
  :name "(/ (- (* x (log 2)) i) (log 2))"
  :precision binary64
  (/ (- (* x (log 2.0)) i) (log 2.0)))