Average Error: 0.0 → 0.0
Time: 9.2s
Precision: 64
\[-\log \left(\frac{1}{x} - 1\right)\]
\[-\log \left(\mathsf{expm1}\left(-\log x\right)\right)\]
-\log \left(\frac{1}{x} - 1\right)
-\log \left(\mathsf{expm1}\left(-\log x\right)\right)
double f(double x) {
        double r293236 = 1.0;
        double r293237 = x;
        double r293238 = r293236 / r293237;
        double r293239 = r293238 - r293236;
        double r293240 = log(r293239);
        double r293241 = -r293240;
        return r293241;
}

double f(double x) {
        double r293242 = x;
        double r293243 = log(r293242);
        double r293244 = -r293243;
        double r293245 = expm1(r293244);
        double r293246 = log(r293245);
        double r293247 = -r293246;
        return r293247;
}

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-exp-log0.0

    \[\leadsto -\log \left(\frac{1}{\color{blue}{e^{\log x}}} - 1\right)\]
  4. Applied rec-exp0.0

    \[\leadsto -\log \left(\color{blue}{e^{-\log x}} - 1\right)\]
  5. Applied expm1-def0.0

    \[\leadsto -\log \color{blue}{\left(\mathsf{expm1}\left(-\log x\right)\right)}\]
  6. Final simplification0.0

    \[\leadsto -\log \left(\mathsf{expm1}\left(-\log x\right)\right)\]

Reproduce

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