Average Error: 7.0 → 3.1
Time: 2.9s
Precision: 64
\[\left(x \cdot y - z \cdot y\right) \cdot t\]
\[\begin{array}{l} \mathbf{if}\;t \le -5.778870560051466615397553491583293903962 \cdot 10^{-114}:\\ \;\;\;\;\left(x - z\right) \cdot \left(t \cdot y\right) + \left(y \cdot \mathsf{fma}\left(-z, 1, z\right)\right) \cdot t\\ \mathbf{elif}\;t \le 3.77456076307271755413490715590529886874 \cdot 10^{62}:\\ \;\;\;\;\left(\left(x - z\right) \cdot t\right) \cdot y + \left(y \cdot \mathsf{fma}\left(-z, 1, z\right)\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt[3]{t \cdot \left(x \cdot y\right)} \cdot \sqrt[3]{t \cdot \left(x \cdot y\right)}\right) \cdot \sqrt[3]{t \cdot \left(x \cdot y\right)} + t \cdot \left(\left(-z\right) \cdot y\right)\\ \end{array}\]
\left(x \cdot y - z \cdot y\right) \cdot t
\begin{array}{l}
\mathbf{if}\;t \le -5.778870560051466615397553491583293903962 \cdot 10^{-114}:\\
\;\;\;\;\left(x - z\right) \cdot \left(t \cdot y\right) + \left(y \cdot \mathsf{fma}\left(-z, 1, z\right)\right) \cdot t\\

\mathbf{elif}\;t \le 3.77456076307271755413490715590529886874 \cdot 10^{62}:\\
\;\;\;\;\left(\left(x - z\right) \cdot t\right) \cdot y + \left(y \cdot \mathsf{fma}\left(-z, 1, z\right)\right) \cdot t\\

\mathbf{else}:\\
\;\;\;\;\left(\sqrt[3]{t \cdot \left(x \cdot y\right)} \cdot \sqrt[3]{t \cdot \left(x \cdot y\right)}\right) \cdot \sqrt[3]{t \cdot \left(x \cdot y\right)} + t \cdot \left(\left(-z\right) \cdot y\right)\\

\end{array}
double f(double x, double y, double z, double t) {
        double r538134 = x;
        double r538135 = y;
        double r538136 = r538134 * r538135;
        double r538137 = z;
        double r538138 = r538137 * r538135;
        double r538139 = r538136 - r538138;
        double r538140 = t;
        double r538141 = r538139 * r538140;
        return r538141;
}

double f(double x, double y, double z, double t) {
        double r538142 = t;
        double r538143 = -5.7788705600514666e-114;
        bool r538144 = r538142 <= r538143;
        double r538145 = x;
        double r538146 = z;
        double r538147 = r538145 - r538146;
        double r538148 = y;
        double r538149 = r538142 * r538148;
        double r538150 = r538147 * r538149;
        double r538151 = -r538146;
        double r538152 = 1.0;
        double r538153 = fma(r538151, r538152, r538146);
        double r538154 = r538148 * r538153;
        double r538155 = r538154 * r538142;
        double r538156 = r538150 + r538155;
        double r538157 = 3.7745607630727176e+62;
        bool r538158 = r538142 <= r538157;
        double r538159 = r538147 * r538142;
        double r538160 = r538159 * r538148;
        double r538161 = r538160 + r538155;
        double r538162 = r538145 * r538148;
        double r538163 = r538142 * r538162;
        double r538164 = cbrt(r538163);
        double r538165 = r538164 * r538164;
        double r538166 = r538165 * r538164;
        double r538167 = r538151 * r538148;
        double r538168 = r538142 * r538167;
        double r538169 = r538166 + r538168;
        double r538170 = r538158 ? r538161 : r538169;
        double r538171 = r538144 ? r538156 : r538170;
        return r538171;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original7.0
Target3.0
Herbie3.1
\[\begin{array}{l} \mathbf{if}\;t \lt -9.231879582886776938073886590448747944753 \cdot 10^{-80}:\\ \;\;\;\;\left(y \cdot t\right) \cdot \left(x - z\right)\\ \mathbf{elif}\;t \lt 2.543067051564877116200336808272775217995 \cdot 10^{83}:\\ \;\;\;\;y \cdot \left(t \cdot \left(x - z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(y \cdot \left(x - z\right)\right) \cdot t\\ \end{array}\]

Derivation

  1. Split input into 3 regimes
  2. if t < -5.7788705600514666e-114

    1. Initial program 3.6

      \[\left(x \cdot y - z \cdot y\right) \cdot t\]
    2. Simplified3.6

      \[\leadsto \color{blue}{t \cdot \left(y \cdot \left(x - z\right)\right)}\]
    3. Using strategy rm
    4. Applied add-cube-cbrt4.1

      \[\leadsto t \cdot \left(y \cdot \left(x - \color{blue}{\left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right) \cdot \sqrt[3]{z}}\right)\right)\]
    5. Applied add-sqr-sqrt34.7

      \[\leadsto t \cdot \left(y \cdot \left(\color{blue}{\sqrt{x} \cdot \sqrt{x}} - \left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right) \cdot \sqrt[3]{z}\right)\right)\]
    6. Applied prod-diff34.7

      \[\leadsto t \cdot \left(y \cdot \color{blue}{\left(\mathsf{fma}\left(\sqrt{x}, \sqrt{x}, -\sqrt[3]{z} \cdot \left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right)\right) + \mathsf{fma}\left(-\sqrt[3]{z}, \sqrt[3]{z} \cdot \sqrt[3]{z}, \sqrt[3]{z} \cdot \left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right)\right)\right)}\right)\]
    7. Applied distribute-lft-in34.7

      \[\leadsto t \cdot \color{blue}{\left(y \cdot \mathsf{fma}\left(\sqrt{x}, \sqrt{x}, -\sqrt[3]{z} \cdot \left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right)\right) + y \cdot \mathsf{fma}\left(-\sqrt[3]{z}, \sqrt[3]{z} \cdot \sqrt[3]{z}, \sqrt[3]{z} \cdot \left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right)\right)\right)}\]
    8. Applied distribute-lft-in34.7

      \[\leadsto \color{blue}{t \cdot \left(y \cdot \mathsf{fma}\left(\sqrt{x}, \sqrt{x}, -\sqrt[3]{z} \cdot \left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right)\right)\right) + t \cdot \left(y \cdot \mathsf{fma}\left(-\sqrt[3]{z}, \sqrt[3]{z} \cdot \sqrt[3]{z}, \sqrt[3]{z} \cdot \left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right)\right)\right)}\]
    9. Simplified4.3

      \[\leadsto \color{blue}{\left(x - z\right) \cdot \left(t \cdot y\right)} + t \cdot \left(y \cdot \mathsf{fma}\left(-\sqrt[3]{z}, \sqrt[3]{z} \cdot \sqrt[3]{z}, \sqrt[3]{z} \cdot \left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right)\right)\right)\]
    10. Simplified3.7

      \[\leadsto \left(x - z\right) \cdot \left(t \cdot y\right) + \color{blue}{\left(y \cdot \mathsf{fma}\left(-z, 1, z\right)\right) \cdot t}\]

    if -5.7788705600514666e-114 < t < 3.7745607630727176e+62

    1. Initial program 9.2

      \[\left(x \cdot y - z \cdot y\right) \cdot t\]
    2. Simplified9.2

      \[\leadsto \color{blue}{t \cdot \left(y \cdot \left(x - z\right)\right)}\]
    3. Using strategy rm
    4. Applied add-cube-cbrt9.6

      \[\leadsto t \cdot \left(y \cdot \left(x - \color{blue}{\left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right) \cdot \sqrt[3]{z}}\right)\right)\]
    5. Applied add-sqr-sqrt36.9

      \[\leadsto t \cdot \left(y \cdot \left(\color{blue}{\sqrt{x} \cdot \sqrt{x}} - \left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right) \cdot \sqrt[3]{z}\right)\right)\]
    6. Applied prod-diff36.9

      \[\leadsto t \cdot \left(y \cdot \color{blue}{\left(\mathsf{fma}\left(\sqrt{x}, \sqrt{x}, -\sqrt[3]{z} \cdot \left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right)\right) + \mathsf{fma}\left(-\sqrt[3]{z}, \sqrt[3]{z} \cdot \sqrt[3]{z}, \sqrt[3]{z} \cdot \left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right)\right)\right)}\right)\]
    7. Applied distribute-lft-in36.9

      \[\leadsto t \cdot \color{blue}{\left(y \cdot \mathsf{fma}\left(\sqrt{x}, \sqrt{x}, -\sqrt[3]{z} \cdot \left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right)\right) + y \cdot \mathsf{fma}\left(-\sqrt[3]{z}, \sqrt[3]{z} \cdot \sqrt[3]{z}, \sqrt[3]{z} \cdot \left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right)\right)\right)}\]
    8. Applied distribute-lft-in36.9

      \[\leadsto \color{blue}{t \cdot \left(y \cdot \mathsf{fma}\left(\sqrt{x}, \sqrt{x}, -\sqrt[3]{z} \cdot \left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right)\right)\right) + t \cdot \left(y \cdot \mathsf{fma}\left(-\sqrt[3]{z}, \sqrt[3]{z} \cdot \sqrt[3]{z}, \sqrt[3]{z} \cdot \left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right)\right)\right)}\]
    9. Simplified14.0

      \[\leadsto \color{blue}{\left(x - z\right) \cdot \left(t \cdot y\right)} + t \cdot \left(y \cdot \mathsf{fma}\left(-\sqrt[3]{z}, \sqrt[3]{z} \cdot \sqrt[3]{z}, \sqrt[3]{z} \cdot \left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right)\right)\right)\]
    10. Simplified9.6

      \[\leadsto \left(x - z\right) \cdot \left(t \cdot y\right) + \color{blue}{\left(y \cdot \mathsf{fma}\left(-z, 1, z\right)\right) \cdot t}\]
    11. Using strategy rm
    12. Applied associate-*r*2.3

      \[\leadsto \color{blue}{\left(\left(x - z\right) \cdot t\right) \cdot y} + \left(y \cdot \mathsf{fma}\left(-z, 1, z\right)\right) \cdot t\]

    if 3.7745607630727176e+62 < t

    1. Initial program 4.7

      \[\left(x \cdot y - z \cdot y\right) \cdot t\]
    2. Simplified4.7

      \[\leadsto \color{blue}{t \cdot \left(y \cdot \left(x - z\right)\right)}\]
    3. Using strategy rm
    4. Applied sub-neg4.7

      \[\leadsto t \cdot \left(y \cdot \color{blue}{\left(x + \left(-z\right)\right)}\right)\]
    5. Applied distribute-lft-in4.7

      \[\leadsto t \cdot \color{blue}{\left(y \cdot x + y \cdot \left(-z\right)\right)}\]
    6. Applied distribute-lft-in4.7

      \[\leadsto \color{blue}{t \cdot \left(y \cdot x\right) + t \cdot \left(y \cdot \left(-z\right)\right)}\]
    7. Simplified4.7

      \[\leadsto \color{blue}{t \cdot \left(x \cdot y\right)} + t \cdot \left(y \cdot \left(-z\right)\right)\]
    8. Simplified4.7

      \[\leadsto t \cdot \left(x \cdot y\right) + \color{blue}{t \cdot \left(\left(-z\right) \cdot y\right)}\]
    9. Using strategy rm
    10. Applied add-cube-cbrt5.2

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -5.778870560051466615397553491583293903962 \cdot 10^{-114}:\\ \;\;\;\;\left(x - z\right) \cdot \left(t \cdot y\right) + \left(y \cdot \mathsf{fma}\left(-z, 1, z\right)\right) \cdot t\\ \mathbf{elif}\;t \le 3.77456076307271755413490715590529886874 \cdot 10^{62}:\\ \;\;\;\;\left(\left(x - z\right) \cdot t\right) \cdot y + \left(y \cdot \mathsf{fma}\left(-z, 1, z\right)\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt[3]{t \cdot \left(x \cdot y\right)} \cdot \sqrt[3]{t \cdot \left(x \cdot y\right)}\right) \cdot \sqrt[3]{t \cdot \left(x \cdot y\right)} + t \cdot \left(\left(-z\right) \cdot y\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019353 +o rules:numerics
(FPCore (x y z t)
  :name "Linear.Projection:inverseInfinitePerspective from linear-1.19.1.3"
  :precision binary64

  :herbie-target
  (if (< t -9.231879582886777e-80) (* (* y t) (- x z)) (if (< t 2.543067051564877e+83) (* y (* t (- x z))) (* (* y (- x z)) t)))

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