Average Error: 0.0 → 0.0
Time: 10.9s
Precision: 64
\[-\log \left(\frac{1}{x} - 1\right)\]
\[-\left(\log \left(\frac{1}{\sqrt{x}} - 1\right) + \mathsf{log1p}\left(\frac{1}{\sqrt{x}}\right)\right)\]
-\log \left(\frac{1}{x} - 1\right)
-\left(\log \left(\frac{1}{\sqrt{x}} - 1\right) + \mathsf{log1p}\left(\frac{1}{\sqrt{x}}\right)\right)
double f(double x) {
        double r196141 = 1.0;
        double r196142 = x;
        double r196143 = r196141 / r196142;
        double r196144 = r196143 - r196141;
        double r196145 = log(r196144);
        double r196146 = -r196145;
        return r196146;
}

double f(double x) {
        double r196147 = 1.0;
        double r196148 = x;
        double r196149 = sqrt(r196148);
        double r196150 = r196147 / r196149;
        double r196151 = r196150 - r196147;
        double r196152 = log(r196151);
        double r196153 = log1p(r196150);
        double r196154 = r196152 + r196153;
        double r196155 = -r196154;
        return r196155;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.0

    \[-\log \left(\frac{1}{x} - 1\right)\]
  2. Using strategy rm
  3. Applied add-sqr-sqrt0.0

    \[\leadsto -\log \left(\frac{1}{x} - \color{blue}{\sqrt{1} \cdot \sqrt{1}}\right)\]
  4. Applied add-sqr-sqrt0.0

    \[\leadsto -\log \left(\frac{1}{\color{blue}{\sqrt{x} \cdot \sqrt{x}}} - \sqrt{1} \cdot \sqrt{1}\right)\]
  5. Applied *-un-lft-identity0.0

    \[\leadsto -\log \left(\frac{\color{blue}{1 \cdot 1}}{\sqrt{x} \cdot \sqrt{x}} - \sqrt{1} \cdot \sqrt{1}\right)\]
  6. Applied times-frac0.0

    \[\leadsto -\log \left(\color{blue}{\frac{1}{\sqrt{x}} \cdot \frac{1}{\sqrt{x}}} - \sqrt{1} \cdot \sqrt{1}\right)\]
  7. Applied difference-of-squares0.0

    \[\leadsto -\log \color{blue}{\left(\left(\frac{1}{\sqrt{x}} + \sqrt{1}\right) \cdot \left(\frac{1}{\sqrt{x}} - \sqrt{1}\right)\right)}\]
  8. Applied log-prod0.0

    \[\leadsto -\color{blue}{\left(\log \left(\frac{1}{\sqrt{x}} + \sqrt{1}\right) + \log \left(\frac{1}{\sqrt{x}} - \sqrt{1}\right)\right)}\]
  9. Simplified0.0

    \[\leadsto -\left(\color{blue}{\mathsf{log1p}\left(\frac{1}{\sqrt{x}}\right)} + \log \left(\frac{1}{\sqrt{x}} - \sqrt{1}\right)\right)\]
  10. Simplified0.0

    \[\leadsto -\left(\mathsf{log1p}\left(\frac{1}{\sqrt{x}}\right) + \color{blue}{\log \left(\frac{1}{\sqrt{x}} - 1\right)}\right)\]
  11. Final simplification0.0

    \[\leadsto -\left(\log \left(\frac{1}{\sqrt{x}} - 1\right) + \mathsf{log1p}\left(\frac{1}{\sqrt{x}}\right)\right)\]

Reproduce

herbie shell --seed 2019146 +o rules:numerics
(FPCore (x)
  :name "neg log"
  (- (log (- (/ 1 x) 1))))