Average Error: 0.0 → 0.0
Time: 2.7s
Precision: 64
\[\frac{x + y}{x - y}\]
\[\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{1}{\frac{x - y}{x + y}}\right)\right)\]
\frac{x + y}{x - y}
\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{1}{\frac{x - y}{x + y}}\right)\right)
double f(double x, double y) {
        double r799784 = x;
        double r799785 = y;
        double r799786 = r799784 + r799785;
        double r799787 = r799784 - r799785;
        double r799788 = r799786 / r799787;
        return r799788;
}

double f(double x, double y) {
        double r799789 = 1.0;
        double r799790 = x;
        double r799791 = y;
        double r799792 = r799790 - r799791;
        double r799793 = r799790 + r799791;
        double r799794 = r799792 / r799793;
        double r799795 = r799789 / r799794;
        double r799796 = expm1(r799795);
        double r799797 = log1p(r799796);
        return r799797;
}

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. Final simplification0.0

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

Reproduce

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

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

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