Average Error: 7.0 → 5.8
Time: 14.0s
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 r32364206 = x;
        double r32364207 = 2.0;
        double r32364208 = r32364206 * r32364207;
        double r32364209 = y;
        double r32364210 = z;
        double r32364211 = r32364209 * r32364210;
        double r32364212 = t;
        double r32364213 = r32364212 * r32364210;
        double r32364214 = r32364211 - r32364213;
        double r32364215 = r32364208 / r32364214;
        return r32364215;
}

double f(double x, double y, double z, double t) {
        double r32364216 = x;
        double r32364217 = 2.0;
        double r32364218 = r32364216 * r32364217;
        double r32364219 = z;
        double r32364220 = y;
        double r32364221 = t;
        double r32364222 = r32364220 - r32364221;
        double r32364223 = r32364219 * r32364222;
        double r32364224 = r32364218 / r32364223;
        return r32364224;
}

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 +o rules:numerics
(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))))