Average Error: 18.2 → 0.0
Time: 14.3s
Precision: binary64
\[1 - \log \left(1 - \frac{x - y}{1 - y}\right) \]
\[\log \left(\frac{e}{1 - x} - \sqrt{e} \cdot \frac{\sqrt{e}}{\frac{1 - x}{y}}\right) \]
1 - \log \left(1 - \frac{x - y}{1 - y}\right)
\log \left(\frac{e}{1 - x} - \sqrt{e} \cdot \frac{\sqrt{e}}{\frac{1 - x}{y}}\right)
(FPCore (x y) :precision binary64 (- 1.0 (log (- 1.0 (/ (- x y) (- 1.0 y))))))
(FPCore (x y)
 :precision binary64
 (log (- (/ E (- 1.0 x)) (* (sqrt E) (/ (sqrt E) (/ (- 1.0 x) y))))))
double code(double x, double y) {
	return 1.0 - log(1.0 - ((x - y) / (1.0 - y)));
}
double code(double x, double y) {
	return log((((double) M_E) / (1.0 - x)) - (sqrt((double) M_E) * (sqrt((double) M_E) / ((1.0 - x) / y))));
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original18.2
Target0.1
Herbie0.0
\[\begin{array}{l} \mathbf{if}\;y < -81284752.61947241:\\ \;\;\;\;1 - \log \left(\frac{x}{y \cdot y} - \left(\frac{1}{y} - \frac{x}{y}\right)\right)\\ \mathbf{elif}\;y < 3.0094271212461764 \cdot 10^{+25}:\\ \;\;\;\;\log \left(\frac{e^{1}}{1 - \frac{x - y}{1 - y}}\right)\\ \mathbf{else}:\\ \;\;\;\;1 - \log \left(\frac{x}{y \cdot y} - \left(\frac{1}{y} - \frac{x}{y}\right)\right)\\ \end{array} \]

Derivation

  1. Initial program 18.2

    \[1 - \log \left(1 - \frac{x - y}{1 - y}\right) \]
  2. Simplified18.2

    \[\leadsto \color{blue}{1 - \mathsf{log1p}\left(\frac{x - y}{y + -1}\right)} \]
  3. Applied log1p-udef_binary6418.2

    \[\leadsto 1 - \color{blue}{\log \left(1 + \frac{x - y}{y + -1}\right)} \]
  4. Applied add-log-exp_binary6418.2

    \[\leadsto \color{blue}{\log \left(e^{1}\right)} - \log \left(1 + \frac{x - y}{y + -1}\right) \]
  5. Applied diff-log_binary6418.2

    \[\leadsto \color{blue}{\log \left(\frac{e^{1}}{1 + \frac{x - y}{y + -1}}\right)} \]
  6. Simplified18.2

    \[\leadsto \log \color{blue}{\left(\frac{e}{1 + \frac{x - y}{y - 1}}\right)} \]
  7. Taylor expanded in y around 0 0.0

    \[\leadsto \log \color{blue}{\left(\frac{e}{1 - x} - \frac{e^{1} \cdot y}{1 - x}\right)} \]
  8. Simplified0.0

    \[\leadsto \log \color{blue}{\left(\frac{e}{1 - x} - \frac{e}{\frac{1 - x}{y}}\right)} \]
  9. Applied *-un-lft-identity_binary640.0

    \[\leadsto \log \left(\frac{e}{1 - x} - \frac{e}{\frac{1 - x}{\color{blue}{1 \cdot y}}}\right) \]
  10. Applied *-un-lft-identity_binary640.0

    \[\leadsto \log \left(\frac{e}{1 - x} - \frac{e}{\frac{\color{blue}{1 \cdot \left(1 - x\right)}}{1 \cdot y}}\right) \]
  11. Applied times-frac_binary640.0

    \[\leadsto \log \left(\frac{e}{1 - x} - \frac{e}{\color{blue}{\frac{1}{1} \cdot \frac{1 - x}{y}}}\right) \]
  12. Applied add-sqr-sqrt_binary640.0

    \[\leadsto \log \left(\frac{e}{1 - x} - \frac{\color{blue}{\sqrt{e} \cdot \sqrt{e}}}{\frac{1}{1} \cdot \frac{1 - x}{y}}\right) \]
  13. Applied times-frac_binary640.0

    \[\leadsto \log \left(\frac{e}{1 - x} - \color{blue}{\frac{\sqrt{e}}{\frac{1}{1}} \cdot \frac{\sqrt{e}}{\frac{1 - x}{y}}}\right) \]
  14. Simplified0.0

    \[\leadsto \log \left(\frac{e}{1 - x} - \color{blue}{\sqrt{e}} \cdot \frac{\sqrt{e}}{\frac{1 - x}{y}}\right) \]
  15. Final simplification0.0

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

Reproduce

herbie shell --seed 2022081 
(FPCore (x y)
  :name "Numeric.SpecFunctions:invIncompleteGamma from math-functions-0.1.5.2, B"
  :precision binary64

  :herbie-target
  (if (< y -81284752.61947241) (- 1.0 (log (- (/ x (* y y)) (- (/ 1.0 y) (/ x y))))) (if (< y 3.0094271212461764e+25) (log (/ (exp 1.0) (- 1.0 (/ (- x y) (- 1.0 y))))) (- 1.0 (log (- (/ x (* y y)) (- (/ 1.0 y) (/ x y)))))))

  (- 1.0 (log (- 1.0 (/ (- x y) (- 1.0 y))))))