Average Error: 0.0 → 0.0
Time: 32.0s
Precision: 64
\[\frac{x + y}{x - y}\]
\[\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{x + y}{x - y}\right)\right)\]
\frac{x + y}{x - y}
\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{x + y}{x - y}\right)\right)
double f(double x, double y) {
        double r23341804 = x;
        double r23341805 = y;
        double r23341806 = r23341804 + r23341805;
        double r23341807 = r23341804 - r23341805;
        double r23341808 = r23341806 / r23341807;
        return r23341808;
}

double f(double x, double y) {
        double r23341809 = x;
        double r23341810 = y;
        double r23341811 = r23341809 + r23341810;
        double r23341812 = r23341809 - r23341810;
        double r23341813 = r23341811 / r23341812;
        double r23341814 = expm1(r23341813);
        double r23341815 = log1p(r23341814);
        return r23341815;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.0
Target0.0
Herbie0.0
\[\frac{1}{\frac{x}{x + y} - \frac{y}{x + y}}\]

Derivation

  1. Initial program 0.0

    \[\frac{x + y}{x - y}\]
  2. Using strategy rm
  3. Applied clear-num0.0

    \[\leadsto \color{blue}{\frac{1}{\frac{x - y}{x + y}}}\]
  4. Using strategy rm
  5. Applied log1p-expm1-u0.0

    \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{1}{\frac{x - y}{x + y}}\right)\right)}\]
  6. Simplified0.0

    \[\leadsto \mathsf{log1p}\left(\color{blue}{\mathsf{expm1}\left(\frac{y + x}{x - y}\right)}\right)\]
  7. Final simplification0.0

    \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{x + y}{x - y}\right)\right)\]

Reproduce

herbie shell --seed 2019168 +o rules:numerics
(FPCore (x y)
  :name "Linear.Projection:perspective from linear-1.19.1.3, A"

  :herbie-target
  (/ 1.0 (- (/ x (+ x y)) (/ y (+ x y))))

  (/ (+ x y) (- x y)))