Average Error: 7.3 → 2.6
Time: 4.4s
Precision: 64
\[\left(x \cdot y - z \cdot y\right) \cdot t\]
\[\begin{array}{l} \mathbf{if}\;t \le -72371502441248638107648:\\ \;\;\;\;\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 17693630633187516781772668928:\\ \;\;\;\;\left(t \cdot \left(1 \cdot x + \left(-z\right)\right)\right) \cdot y + \left(y \cdot \mathsf{fma}\left(-z, 1, z\right)\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(y \cdot \left(x - z\right)\right)\\ \end{array}\]
\left(x \cdot y - z \cdot y\right) \cdot t
\begin{array}{l}
\mathbf{if}\;t \le -72371502441248638107648:\\
\;\;\;\;\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 17693630633187516781772668928:\\
\;\;\;\;\left(t \cdot \left(1 \cdot x + \left(-z\right)\right)\right) \cdot y + \left(y \cdot \mathsf{fma}\left(-z, 1, z\right)\right) \cdot t\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r564243 = x;
        double r564244 = y;
        double r564245 = r564243 * r564244;
        double r564246 = z;
        double r564247 = r564246 * r564244;
        double r564248 = r564245 - r564247;
        double r564249 = t;
        double r564250 = r564248 * r564249;
        return r564250;
}

double f(double x, double y, double z, double t) {
        double r564251 = t;
        double r564252 = -7.237150244124864e+22;
        bool r564253 = r564251 <= r564252;
        double r564254 = x;
        double r564255 = z;
        double r564256 = r564254 - r564255;
        double r564257 = y;
        double r564258 = r564251 * r564257;
        double r564259 = r564256 * r564258;
        double r564260 = -r564255;
        double r564261 = 1.0;
        double r564262 = fma(r564260, r564261, r564255);
        double r564263 = r564257 * r564262;
        double r564264 = r564263 * r564251;
        double r564265 = r564259 + r564264;
        double r564266 = 1.7693630633187517e+28;
        bool r564267 = r564251 <= r564266;
        double r564268 = r564261 * r564254;
        double r564269 = r564268 + r564260;
        double r564270 = r564251 * r564269;
        double r564271 = r564270 * r564257;
        double r564272 = r564271 + r564264;
        double r564273 = r564257 * r564256;
        double r564274 = r564251 * r564273;
        double r564275 = r564267 ? r564272 : r564274;
        double r564276 = r564253 ? r564265 : r564275;
        return r564276;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original7.3
Target3.1
Herbie2.6
\[\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 < -7.237150244124864e+22

    1. Initial program 3.9

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

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

      \[\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.3

      \[\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.3

      \[\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.3

      \[\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.3

      \[\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. Simplified4.3

      \[\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 -7.237150244124864e+22 < t < 1.7693630633187517e+28

    1. Initial program 9.1

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

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

      \[\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-cube-cbrt9.9

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

      \[\leadsto t \cdot \left(y \cdot \color{blue}{\left(\mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt[3]{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-in9.9

      \[\leadsto t \cdot \color{blue}{\left(y \cdot \mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt[3]{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-in9.9

      \[\leadsto \color{blue}{t \cdot \left(y \cdot \mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt[3]{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. Simplified6.7

      \[\leadsto \color{blue}{\left(t \cdot \left(1 \cdot {\left(\sqrt[3]{x}\right)}^{3} + \left(-z\right)\right)\right) \cdot y} + 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. Simplified2.4

      \[\leadsto \left(t \cdot \left(1 \cdot {\left(\sqrt[3]{x}\right)}^{3} + \left(-z\right)\right)\right) \cdot y + \color{blue}{\left(y \cdot \mathsf{fma}\left(-z, 1, z\right)\right) \cdot t}\]
    11. Using strategy rm
    12. Applied rem-cube-cbrt1.9

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

    if 1.7693630633187517e+28 < t

    1. Initial program 3.7

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -72371502441248638107648:\\ \;\;\;\;\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 17693630633187516781772668928:\\ \;\;\;\;\left(t \cdot \left(1 \cdot x + \left(-z\right)\right)\right) \cdot y + \left(y \cdot \mathsf{fma}\left(-z, 1, z\right)\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(y \cdot \left(x - z\right)\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020001 +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))