Average Error: 6.8 → 3.0
Time: 10.1s
Precision: 64
\[\frac{x \cdot 2}{y \cdot z - t \cdot z}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot 2 \le -7.239284083966433340971141087068091802766 \cdot 10^{62} \lor \neg \left(x \cdot 2 \le 3.757552955654937149870253387206513889626 \cdot 10^{-155}\right):\\ \;\;\;\;\frac{\frac{2 \cdot x}{y - t}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot x}{\left(y - t\right) \cdot z}\\ \end{array}\]
\frac{x \cdot 2}{y \cdot z - t \cdot z}
\begin{array}{l}
\mathbf{if}\;x \cdot 2 \le -7.239284083966433340971141087068091802766 \cdot 10^{62} \lor \neg \left(x \cdot 2 \le 3.757552955654937149870253387206513889626 \cdot 10^{-155}\right):\\
\;\;\;\;\frac{\frac{2 \cdot x}{y - t}}{z}\\

\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot x}{\left(y - t\right) \cdot z}\\

\end{array}
double f(double x, double y, double z, double t) {
        double r350563 = x;
        double r350564 = 2.0;
        double r350565 = r350563 * r350564;
        double r350566 = y;
        double r350567 = z;
        double r350568 = r350566 * r350567;
        double r350569 = t;
        double r350570 = r350569 * r350567;
        double r350571 = r350568 - r350570;
        double r350572 = r350565 / r350571;
        return r350572;
}

double f(double x, double y, double z, double t) {
        double r350573 = x;
        double r350574 = 2.0;
        double r350575 = r350573 * r350574;
        double r350576 = -7.239284083966433e+62;
        bool r350577 = r350575 <= r350576;
        double r350578 = 3.757552955654937e-155;
        bool r350579 = r350575 <= r350578;
        double r350580 = !r350579;
        bool r350581 = r350577 || r350580;
        double r350582 = r350574 * r350573;
        double r350583 = y;
        double r350584 = t;
        double r350585 = r350583 - r350584;
        double r350586 = r350582 / r350585;
        double r350587 = z;
        double r350588 = r350586 / r350587;
        double r350589 = r350585 * r350587;
        double r350590 = r350582 / r350589;
        double r350591 = r350581 ? r350588 : r350590;
        return r350591;
}

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

Original6.8
Target2.1
Herbie3.0
\[\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. Split input into 2 regimes
  2. if (* x 2.0) < -7.239284083966433e+62 or 3.757552955654937e-155 < (* x 2.0)

    1. Initial program 9.3

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z}\]
    2. Simplified8.5

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}}\]
    3. Using strategy rm
    4. Applied associate-/r*9.1

      \[\leadsto \color{blue}{\frac{\frac{x \cdot 2}{z}}{y - t}}\]
    5. Using strategy rm
    6. Applied clear-num9.5

      \[\leadsto \color{blue}{\frac{1}{\frac{y - t}{\frac{x \cdot 2}{z}}}}\]
    7. Using strategy rm
    8. Applied associate-/r/3.9

      \[\leadsto \frac{1}{\color{blue}{\frac{y - t}{x \cdot 2} \cdot z}}\]
    9. Applied associate-/r*3.8

      \[\leadsto \color{blue}{\frac{\frac{1}{\frac{y - t}{x \cdot 2}}}{z}}\]
    10. Simplified3.6

      \[\leadsto \frac{\color{blue}{\frac{2 \cdot x}{y - t}}}{z}\]

    if -7.239284083966433e+62 < (* x 2.0) < 3.757552955654937e-155

    1. Initial program 3.9

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z}\]
    2. Simplified2.3

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity2.3

      \[\leadsto \frac{x \cdot 2}{\color{blue}{\left(1 \cdot z\right)} \cdot \left(y - t\right)}\]
    5. Applied associate-*l*2.3

      \[\leadsto \frac{x \cdot 2}{\color{blue}{1 \cdot \left(z \cdot \left(y - t\right)\right)}}\]
    6. Simplified2.3

      \[\leadsto \frac{x \cdot 2}{1 \cdot \color{blue}{\left(\left(y - t\right) \cdot z\right)}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification3.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot 2 \le -7.239284083966433340971141087068091802766 \cdot 10^{62} \lor \neg \left(x \cdot 2 \le 3.757552955654937149870253387206513889626 \cdot 10^{-155}\right):\\ \;\;\;\;\frac{\frac{2 \cdot x}{y - t}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot x}{\left(y - t\right) \cdot z}\\ \end{array}\]

Reproduce

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

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

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