Average Error: 6.7 → 2.5
Time: 7.6s
Precision: 64
\[\frac{x \cdot 2}{y \cdot z - t \cdot z}\]
\[\begin{array}{l} \mathbf{if}\;x \le -7.5168010274110233 \cdot 10^{-302} \lor \neg \left(x \le 1.567521217467982 \cdot 10^{132}\right):\\ \;\;\;\;\frac{\sqrt[3]{\sqrt[3]{x}} \cdot \sqrt[3]{\sqrt[3]{x}}}{\frac{\sqrt[3]{z} \cdot \sqrt[3]{z}}{\sqrt[3]{\sqrt[3]{x}} \cdot \sqrt[3]{\sqrt[3]{x}}}} \cdot \left(\frac{\sqrt[3]{\sqrt[3]{x}}}{\frac{\sqrt[3]{z}}{\sqrt[3]{\sqrt[3]{x}}}} \cdot \frac{\sqrt[3]{x}}{\frac{y - t}{2}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{z}}{\frac{y - t}{2}}\\ \end{array}\]
\frac{x \cdot 2}{y \cdot z - t \cdot z}
\begin{array}{l}
\mathbf{if}\;x \le -7.5168010274110233 \cdot 10^{-302} \lor \neg \left(x \le 1.567521217467982 \cdot 10^{132}\right):\\
\;\;\;\;\frac{\sqrt[3]{\sqrt[3]{x}} \cdot \sqrt[3]{\sqrt[3]{x}}}{\frac{\sqrt[3]{z} \cdot \sqrt[3]{z}}{\sqrt[3]{\sqrt[3]{x}} \cdot \sqrt[3]{\sqrt[3]{x}}}} \cdot \left(\frac{\sqrt[3]{\sqrt[3]{x}}}{\frac{\sqrt[3]{z}}{\sqrt[3]{\sqrt[3]{x}}}} \cdot \frac{\sqrt[3]{x}}{\frac{y - t}{2}}\right)\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r531124 = x;
        double r531125 = 2.0;
        double r531126 = r531124 * r531125;
        double r531127 = y;
        double r531128 = z;
        double r531129 = r531127 * r531128;
        double r531130 = t;
        double r531131 = r531130 * r531128;
        double r531132 = r531129 - r531131;
        double r531133 = r531126 / r531132;
        return r531133;
}

double f(double x, double y, double z, double t) {
        double r531134 = x;
        double r531135 = -7.516801027411023e-302;
        bool r531136 = r531134 <= r531135;
        double r531137 = 1.567521217467982e+132;
        bool r531138 = r531134 <= r531137;
        double r531139 = !r531138;
        bool r531140 = r531136 || r531139;
        double r531141 = cbrt(r531134);
        double r531142 = cbrt(r531141);
        double r531143 = r531142 * r531142;
        double r531144 = z;
        double r531145 = cbrt(r531144);
        double r531146 = r531145 * r531145;
        double r531147 = r531146 / r531143;
        double r531148 = r531143 / r531147;
        double r531149 = r531145 / r531142;
        double r531150 = r531142 / r531149;
        double r531151 = y;
        double r531152 = t;
        double r531153 = r531151 - r531152;
        double r531154 = 2.0;
        double r531155 = r531153 / r531154;
        double r531156 = r531141 / r531155;
        double r531157 = r531150 * r531156;
        double r531158 = r531148 * r531157;
        double r531159 = r531134 / r531144;
        double r531160 = r531159 / r531155;
        double r531161 = r531140 ? r531158 : r531160;
        return r531161;
}

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.7
Target2.3
Herbie2.5
\[\begin{array}{l} \mathbf{if}\;\frac{x \cdot 2}{y \cdot z - t \cdot z} \lt -2.559141628295061 \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.04502782733012586 \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 < -7.516801027411023e-302 or 1.567521217467982e+132 < x

    1. Initial program 8.2

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

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

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

      \[\leadsto \frac{x}{\color{blue}{\frac{z}{1} \cdot \frac{y - t}{2}}}\]
    6. Applied add-cube-cbrt7.9

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}}}{\frac{z}{1} \cdot \frac{y - t}{2}}\]
    7. Applied times-frac6.1

      \[\leadsto \color{blue}{\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\frac{z}{1}} \cdot \frac{\sqrt[3]{x}}{\frac{y - t}{2}}}\]
    8. Simplified6.1

      \[\leadsto \color{blue}{\frac{\sqrt[3]{x}}{\frac{z}{\sqrt[3]{x}}}} \cdot \frac{\sqrt[3]{x}}{\frac{y - t}{2}}\]
    9. Using strategy rm
    10. Applied add-cube-cbrt6.3

      \[\leadsto \frac{\sqrt[3]{x}}{\frac{z}{\color{blue}{\left(\sqrt[3]{\sqrt[3]{x}} \cdot \sqrt[3]{\sqrt[3]{x}}\right) \cdot \sqrt[3]{\sqrt[3]{x}}}}} \cdot \frac{\sqrt[3]{x}}{\frac{y - t}{2}}\]
    11. Applied add-cube-cbrt6.4

      \[\leadsto \frac{\sqrt[3]{x}}{\frac{\color{blue}{\left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right) \cdot \sqrt[3]{z}}}{\left(\sqrt[3]{\sqrt[3]{x}} \cdot \sqrt[3]{\sqrt[3]{x}}\right) \cdot \sqrt[3]{\sqrt[3]{x}}}} \cdot \frac{\sqrt[3]{x}}{\frac{y - t}{2}}\]
    12. Applied times-frac6.4

      \[\leadsto \frac{\sqrt[3]{x}}{\color{blue}{\frac{\sqrt[3]{z} \cdot \sqrt[3]{z}}{\sqrt[3]{\sqrt[3]{x}} \cdot \sqrt[3]{\sqrt[3]{x}}} \cdot \frac{\sqrt[3]{z}}{\sqrt[3]{\sqrt[3]{x}}}}} \cdot \frac{\sqrt[3]{x}}{\frac{y - t}{2}}\]
    13. Applied add-cube-cbrt6.7

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{\sqrt[3]{x}} \cdot \sqrt[3]{\sqrt[3]{x}}\right) \cdot \sqrt[3]{\sqrt[3]{x}}}}{\frac{\sqrt[3]{z} \cdot \sqrt[3]{z}}{\sqrt[3]{\sqrt[3]{x}} \cdot \sqrt[3]{\sqrt[3]{x}}} \cdot \frac{\sqrt[3]{z}}{\sqrt[3]{\sqrt[3]{x}}}} \cdot \frac{\sqrt[3]{x}}{\frac{y - t}{2}}\]
    14. Applied times-frac6.7

      \[\leadsto \color{blue}{\left(\frac{\sqrt[3]{\sqrt[3]{x}} \cdot \sqrt[3]{\sqrt[3]{x}}}{\frac{\sqrt[3]{z} \cdot \sqrt[3]{z}}{\sqrt[3]{\sqrt[3]{x}} \cdot \sqrt[3]{\sqrt[3]{x}}}} \cdot \frac{\sqrt[3]{\sqrt[3]{x}}}{\frac{\sqrt[3]{z}}{\sqrt[3]{\sqrt[3]{x}}}}\right)} \cdot \frac{\sqrt[3]{x}}{\frac{y - t}{2}}\]
    15. Applied associate-*l*2.5

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

    if -7.516801027411023e-302 < x < 1.567521217467982e+132

    1. Initial program 4.3

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{x}{\frac{z}{1}}}{\frac{y - t}{2}}}\]
    7. Simplified2.6

      \[\leadsto \frac{\color{blue}{\frac{x}{z}}}{\frac{y - t}{2}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification2.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -7.5168010274110233 \cdot 10^{-302} \lor \neg \left(x \le 1.567521217467982 \cdot 10^{132}\right):\\ \;\;\;\;\frac{\sqrt[3]{\sqrt[3]{x}} \cdot \sqrt[3]{\sqrt[3]{x}}}{\frac{\sqrt[3]{z} \cdot \sqrt[3]{z}}{\sqrt[3]{\sqrt[3]{x}} \cdot \sqrt[3]{\sqrt[3]{x}}}} \cdot \left(\frac{\sqrt[3]{\sqrt[3]{x}}}{\frac{\sqrt[3]{z}}{\sqrt[3]{\sqrt[3]{x}}}} \cdot \frac{\sqrt[3]{x}}{\frac{y - t}{2}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{z}}{\frac{y - t}{2}}\\ \end{array}\]

Reproduce

herbie shell --seed 2020062 +o rules:numerics
(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.0450278273301259e-269) (/ (* (/ x z) 2) (- y t)) (* (/ x (* (- y t) z)) 2)))

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