Average Error: 6.9 → 3.2
Time: 10.7s
Precision: 64
\[\frac{x \cdot 2.0}{y \cdot z - t \cdot z}\]
\[\begin{array}{l} \mathbf{if}\;x \le -1.1956576016905496 \cdot 10^{-61}:\\ \;\;\;\;\frac{\frac{2.0}{y - t} \cdot x}{z}\\ \mathbf{elif}\;x \le 1.3088576305874405 \cdot 10^{-231}:\\ \;\;\;\;\frac{2.0 \cdot x}{z \cdot \left(y - t\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{2.0}{y - t} \cdot x}{z}\\ \end{array}\]
\frac{x \cdot 2.0}{y \cdot z - t \cdot z}
\begin{array}{l}
\mathbf{if}\;x \le -1.1956576016905496 \cdot 10^{-61}:\\
\;\;\;\;\frac{\frac{2.0}{y - t} \cdot x}{z}\\

\mathbf{elif}\;x \le 1.3088576305874405 \cdot 10^{-231}:\\
\;\;\;\;\frac{2.0 \cdot x}{z \cdot \left(y - t\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{2.0}{y - t} \cdot x}{z}\\

\end{array}
double f(double x, double y, double z, double t) {
        double r11006996 = x;
        double r11006997 = 2.0;
        double r11006998 = r11006996 * r11006997;
        double r11006999 = y;
        double r11007000 = z;
        double r11007001 = r11006999 * r11007000;
        double r11007002 = t;
        double r11007003 = r11007002 * r11007000;
        double r11007004 = r11007001 - r11007003;
        double r11007005 = r11006998 / r11007004;
        return r11007005;
}

double f(double x, double y, double z, double t) {
        double r11007006 = x;
        double r11007007 = -1.1956576016905496e-61;
        bool r11007008 = r11007006 <= r11007007;
        double r11007009 = 2.0;
        double r11007010 = y;
        double r11007011 = t;
        double r11007012 = r11007010 - r11007011;
        double r11007013 = r11007009 / r11007012;
        double r11007014 = r11007013 * r11007006;
        double r11007015 = z;
        double r11007016 = r11007014 / r11007015;
        double r11007017 = 1.3088576305874405e-231;
        bool r11007018 = r11007006 <= r11007017;
        double r11007019 = r11007009 * r11007006;
        double r11007020 = r11007015 * r11007012;
        double r11007021 = r11007019 / r11007020;
        double r11007022 = r11007018 ? r11007021 : r11007016;
        double r11007023 = r11007008 ? r11007016 : r11007022;
        return r11007023;
}

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.9
Target2.2
Herbie3.2
\[\begin{array}{l} \mathbf{if}\;\frac{x \cdot 2.0}{y \cdot z - t \cdot z} \lt -2.559141628295061 \cdot 10^{-13}:\\ \;\;\;\;\frac{x}{\left(y - t\right) \cdot z} \cdot 2.0\\ \mathbf{elif}\;\frac{x \cdot 2.0}{y \cdot z - t \cdot z} \lt 1.045027827330126 \cdot 10^{-269}:\\ \;\;\;\;\frac{\frac{x}{z} \cdot 2.0}{y - t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\left(y - t\right) \cdot z} \cdot 2.0\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if x < -1.1956576016905496e-61 or 1.3088576305874405e-231 < x

    1. Initial program 8.4

      \[\frac{x \cdot 2.0}{y \cdot z - t \cdot z}\]
    2. Simplified6.7

      \[\leadsto \color{blue}{\frac{2.0}{y - t} \cdot \frac{x}{z}}\]
    3. Using strategy rm
    4. Applied associate-*r/3.7

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

    if -1.1956576016905496e-61 < x < 1.3088576305874405e-231

    1. Initial program 3.3

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

      \[\leadsto \color{blue}{\frac{2.0}{y - t} \cdot \frac{x}{z}}\]
    3. Using strategy rm
    4. Applied frac-times1.9

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -1.1956576016905496 \cdot 10^{-61}:\\ \;\;\;\;\frac{\frac{2.0}{y - t} \cdot x}{z}\\ \mathbf{elif}\;x \le 1.3088576305874405 \cdot 10^{-231}:\\ \;\;\;\;\frac{2.0 \cdot x}{z \cdot \left(y - t\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{2.0}{y - t} \cdot x}{z}\\ \end{array}\]

Reproduce

herbie shell --seed 2019156 
(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))))