Average Error: 63.0 → 0
Time: 11.4s
Precision: binary64
Cost: 6464
\[n > 6.8 \cdot 10^{+15}\]
\[\left(\left(n + 1\right) \cdot \log \left(n + 1\right) - n \cdot \log n\right) - 1\]
\[\log n\]
\left(\left(n + 1\right) \cdot \log \left(n + 1\right) - n \cdot \log n\right) - 1
\log n
(FPCore (n)
 :precision binary64
 (- (- (* (+ n 1.0) (log (+ n 1.0))) (* n (log n))) 1.0))
(FPCore (n) :precision binary64 (log n))
double code(double n) {
	return (((n + 1.0) * log(n + 1.0)) - (n * log(n))) - 1.0;
}
double code(double n) {
	return log(n);
}

Error

Bits error versus n

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original63.0
Target0
Herbie0
\[\log \left(n + 1\right) - \left(\frac{1}{2 \cdot n} - \left(\frac{1}{3 \cdot \left(n \cdot n\right)} - \frac{4}{{n}^{3}}\right)\right)\]

Alternatives

Alternative 1
Error63.7
Cost60352
\[\frac{{\left(\left(n + 1\right) \cdot \log \left(n + 1\right)\right)}^{3} - {\left(n \cdot \log n\right)}^{3}}{\left(n \cdot \log n\right) \cdot \left(n \cdot \log n\right) + \left(\left(n + 1\right) \cdot \log \left(n + 1\right)\right) \cdot \left(n \cdot \log n + \left(n + 1\right) \cdot \log \left(n + 1\right)\right)} - 1\]
Alternative 2
Error63.1
Cost46976
\[\frac{\log \left(n + 1\right) \cdot \left(\log \left(n + 1\right) \cdot {\left(n + 1\right)}^{2}\right) - \left(n \cdot \log n\right) \cdot \left(n \cdot \log n\right)}{n \cdot \log n + \left(n + 1\right) \cdot \log \left(n + 1\right)} - 1\]
Alternative 3
Error61.8
Cost46656
\[\left(\sqrt[3]{\left(n + 1\right) \cdot \log \left(n + 1\right)} \cdot \left(\sqrt[3]{\left(n + 1\right) \cdot \log \left(n + 1\right)} \cdot \sqrt[3]{\left(n + 1\right) \cdot \log \left(n + 1\right)}\right) - n \cdot \log n\right) - 1\]
Alternative 4
Error62.4
Cost46144
\[\left(\left(n + 1\right) \cdot \log \left(n + 1\right) - \sqrt[3]{n \cdot \log n} \cdot \left(\sqrt[3]{n \cdot \log n} \cdot \sqrt[3]{n \cdot \log n}\right)\right) - 1\]
Alternative 5
Error61.9
Cost46144
\[\left(\sqrt[3]{\log \left(n + 1\right)} \cdot \left(\left(n + 1\right) \cdot \left(\sqrt[3]{\log \left(n + 1\right)} \cdot \sqrt[3]{\log \left(n + 1\right)}\right)\right) - n \cdot \log n\right) - 1\]
Alternative 6
Error62.3
Cost45888
\[\left(\left(n + 1\right) \cdot \log \left(n + 1\right) - \sqrt[3]{\log n} \cdot \left(n \cdot \left(\sqrt[3]{\log n} \cdot \sqrt[3]{\log n}\right)\right)\right) - 1\]
Alternative 7
Error62.3
Cost45888
\[\left(\left(n + 1\right) \cdot \log \left(n + 1\right) - \left(\sqrt{\log n} \cdot \sqrt{n}\right) \cdot \left(\sqrt{\log n} \cdot \sqrt{n}\right)\right) - 1\]
Alternative 8
Error62.1
Cost40000
\[\left(\left(n + 1\right) \cdot \log \left(\sqrt[3]{n + 1} \cdot \sqrt[3]{n + 1}\right) + \left(\left(n + 1\right) \cdot \log \left(\sqrt[3]{n + 1}\right) - n \cdot \log n\right)\right) - 1\]
Alternative 9
Error62.5
Cost33472
\[\left(\left(\left(n + 1\right) \cdot \left(\log \left(\sqrt[3]{n + 1}\right) \cdot 2\right) + \left(n + 1\right) \cdot \log \left(\sqrt[3]{n + 1}\right)\right) - n \cdot \log n\right) - 1\]
Alternative 10
Error62.5
Cost33344
\[\left(\sqrt{\left(n + 1\right) \cdot \log \left(n + 1\right)} \cdot \sqrt{\left(n + 1\right) \cdot \log \left(n + 1\right)} - n \cdot \log n\right) - 1\]
Alternative 11
Error63.0
Cost33344
\[\left(\left(n + 1\right) \cdot \log \left(\sqrt{n + 1}\right) + \left(\left(n + 1\right) \cdot \log \left(\sqrt{n + 1}\right) - n \cdot \log n\right)\right) - 1\]
Alternative 12
Error61.9
Cost33344
\[\left(\left(\sqrt[3]{n + 1} \cdot \sqrt[3]{n + 1}\right) \cdot \left(\log \left(n + 1\right) \cdot \sqrt[3]{n + 1}\right) - n \cdot \log n\right) - 1\]
Alternative 13
Error62.2
Cost33216
\[\left(\left(\left(n + 1\right) \cdot \log \left(n + 1\right) - n \cdot \left(2 \cdot \log \left(\sqrt[3]{n}\right)\right)\right) - n \cdot \log \left(\sqrt[3]{n}\right)\right) - 1\]
Alternative 14
Error62.6
Cost33216
\[\left(\left(n + 1\right) \cdot \log \left(n + 1\right) - \left(n \cdot \left(2 \cdot \log \left(\sqrt[3]{n}\right)\right) + n \cdot \log \left(\sqrt[3]{n}\right)\right)\right) - 1\]
Alternative 15
Error62.5
Cost33088
\[\left(\left(n + 1\right) \cdot \log \left(n + 1\right) - \sqrt{n \cdot \log n} \cdot \sqrt{n \cdot \log n}\right) - 1\]
Alternative 16
Error62.4
Cost33088
\[\left(\sqrt{\log \left(n + 1\right)} \cdot \left(\left(n + 1\right) \cdot \sqrt{\log \left(n + 1\right)}\right) - n \cdot \log n\right) - 1\]
Alternative 17
Error62.4
Cost33088
\[\left(\left(n + 1\right) \cdot \log \left(n + 1\right) - \left(\sqrt[3]{n} \cdot \sqrt[3]{n}\right) \cdot \left(\log n \cdot \sqrt[3]{n}\right)\right) - 1\]
Alternative 18
Error62.4
Cost32960
\[\left(\left(n + 1\right) \cdot \log \left(n + 1\right) - \sqrt{\log n} \cdot \left(n \cdot \sqrt{\log n}\right)\right) - 1\]
Alternative 19
Error62.5
Cost26688
\[\left(\sqrt{n + 1} \cdot \left(\log \left(n + 1\right) \cdot \sqrt{n + 1}\right) - n \cdot \log n\right) - 1\]
Alternative 20
Error62.4
Cost26560
\[\left(\left(n + 1\right) \cdot \log \left(n + 1\right) - \sqrt{n} \cdot \left(\log n \cdot \sqrt{n}\right)\right) - 1\]
Alternative 21
Error63.5
Cost26496
\[\left(\left(n + 1\right) \cdot \log \left(n + 1\right) - \sqrt[3]{{\left(n \cdot \log n\right)}^{3}}\right) - 1\]
Alternative 22
Error63.3
Cost26496
\[\left(\sqrt[3]{{\left(\left(n + 1\right) \cdot \log \left(n + 1\right)\right)}^{3}} - n \cdot \log n\right) - 1\]
Alternative 23
Error62.0
Cost26432
\[\left(\left(n + 1\right) \cdot \log \left(n + 1\right) - e^{\log \left(n \cdot \log n\right)}\right) - 1\]
Alternative 24
Error61.9
Cost26432
\[\left(e^{\log \left(\left(n + 1\right) \cdot \log \left(n + 1\right)\right)} - n \cdot \log n\right) - 1\]
Alternative 25
Error63.0
Cost26432
\[e^{\log \left(\left(n + 1\right) \cdot \log \left(n + 1\right) - n \cdot \log n\right)} - 1\]
Alternative 26
Error63.5
Cost20608
\[\left(\frac{\log \left(n + 1\right) \cdot \left(1 + {n}^{3}\right)}{n \cdot n + \left(1 - n\right)} - n \cdot \log n\right) - 1\]
Alternative 27
Error63.3
Cost14016
\[\left(\frac{\log \left(n + 1\right) \cdot \left(n \cdot n - 1\right)}{n - 1} - n \cdot \log n\right) - 1\]
Alternative 28
Error63.0
Cost13632
\[\left(\left(n + 1\right) \cdot \log \left(n + 1\right) - n \cdot \log n\right) - 1\]
Alternative 29
Error63.3
Cost6848
\[\left(n - n \cdot \log n\right) - 1\]
Alternative 30
Error0.0
Cost6720
\[\left(1 + \log n\right) - 1\]
Alternative 31
Error55.0
Cost64
\[1\]
Alternative 32
Error62.0
Cost64
\[0\]
Alternative 33
Error63.0
Cost64
\[-1\]

Error

Derivation

  1. Initial program 63.0

    \[\left(\left(n + 1\right) \cdot \log \left(n + 1\right) - n \cdot \log n\right) - 1\]
  2. Taylor expanded around inf 0.0

    \[\leadsto \color{blue}{\left(1 - \log \left(\frac{1}{n}\right)\right)} - 1\]
  3. Simplified0.0

    \[\leadsto \color{blue}{\left(1 + \log n\right)} - 1\]
  4. Using strategy rm
  5. Applied add-log-exp_binary64_17750.0

    \[\leadsto \left(1 + \log n\right) - \color{blue}{\log \left(e^{1}\right)}\]
  6. Applied add-log-exp_binary64_17750.0

    \[\leadsto \left(\color{blue}{\log \left(e^{1}\right)} + \log n\right) - \log \left(e^{1}\right)\]
  7. Applied sum-log_binary64_18270.1

    \[\leadsto \color{blue}{\log \left(e^{1} \cdot n\right)} - \log \left(e^{1}\right)\]
  8. Applied diff-log_binary64_18280.1

    \[\leadsto \color{blue}{\log \left(\frac{e^{1} \cdot n}{e^{1}}\right)}\]
  9. Simplified0

    \[\leadsto \log \color{blue}{n}\]
  10. Simplified0

    \[\leadsto \color{blue}{\log n}\]
  11. Final simplification0

    \[\leadsto \log n\]

Reproduce

herbie shell --seed 2021042 
(FPCore (n)
  :name "logs (example 3.8)"
  :precision binary64
  :pre (> n 6.8e+15)

  :herbie-target
  (- (log (+ n 1.0)) (- (/ 1.0 (* 2.0 n)) (- (/ 1.0 (* 3.0 (* n n))) (/ 4.0 (pow n 3.0)))))

  (- (- (* (+ n 1.0) (log (+ n 1.0))) (* n (log n))) 1.0))