Average Error: 7.0 → 5.8
Time: 13.3s
Precision: 64
\[\frac{x \cdot 2}{y \cdot z - t \cdot z}\]
\[\frac{x \cdot 2}{z \cdot \left(y - t\right)}\]
\frac{x \cdot 2}{y \cdot z - t \cdot z}
\frac{x \cdot 2}{z \cdot \left(y - t\right)}
double f(double x, double y, double z, double t) {
        double r37812020 = x;
        double r37812021 = 2.0;
        double r37812022 = r37812020 * r37812021;
        double r37812023 = y;
        double r37812024 = z;
        double r37812025 = r37812023 * r37812024;
        double r37812026 = t;
        double r37812027 = r37812026 * r37812024;
        double r37812028 = r37812025 - r37812027;
        double r37812029 = r37812022 / r37812028;
        return r37812029;
}

double f(double x, double y, double z, double t) {
        double r37812030 = x;
        double r37812031 = 2.0;
        double r37812032 = r37812030 * r37812031;
        double r37812033 = z;
        double r37812034 = y;
        double r37812035 = t;
        double r37812036 = r37812034 - r37812035;
        double r37812037 = r37812033 * r37812036;
        double r37812038 = r37812032 / r37812037;
        return r37812038;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original7.0
Target2.0
Herbie5.8
\[\begin{array}{l} \mathbf{if}\;\frac{x \cdot 2}{y \cdot z - t \cdot z} \lt -2.559141628295061113708240820439530037456 \cdot 10^{-13}:\\ \;\;\;\;\frac{x}{\left(y - t\right) \cdot z} \cdot 2\\ \mathbf{elif}\;\frac{x \cdot 2}{y \cdot z - t \cdot z} \lt 1.045027827330126029709547581125571222799 \cdot 10^{-269}:\\ \;\;\;\;\frac{\frac{x}{z} \cdot 2}{y - t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\left(y - t\right) \cdot z} \cdot 2\\ \end{array}\]

Derivation

  1. Initial program 7.0

    \[\frac{x \cdot 2}{y \cdot z - t \cdot z}\]
  2. Simplified5.8

    \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}}\]
  3. Final simplification5.8

    \[\leadsto \frac{x \cdot 2}{z \cdot \left(y - t\right)}\]

Reproduce

herbie shell --seed 2019174 
(FPCore (x y z t)
  :name "Linear.Projection:infinitePerspective from linear-1.19.1.3, A"

  :herbie-target
  (if (< (/ (* x 2.0) (- (* y z) (* t z))) -2.559141628295061e-13) (* (/ x (* (- y t) z)) 2.0) (if (< (/ (* x 2.0) (- (* y z) (* t z))) 1.045027827330126e-269) (/ (* (/ x z) 2.0) (- y t)) (* (/ x (* (- y t) z)) 2.0)))

  (/ (* x 2.0) (- (* y z) (* t z))))