Average Error: 7.3 → 2.6
Time: 4.5s
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)\\ \mathbf{elif}\;t \le 17693630633187516781772668928:\\ \;\;\;\;\left(t \cdot \left(1 \cdot {x}^{1} + \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)\\

\mathbf{elif}\;t \le 17693630633187516781772668928:\\
\;\;\;\;\left(t \cdot \left(1 \cdot {x}^{1} + \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 r547461 = x;
        double r547462 = y;
        double r547463 = r547461 * r547462;
        double r547464 = z;
        double r547465 = r547464 * r547462;
        double r547466 = r547463 - r547465;
        double r547467 = t;
        double r547468 = r547466 * r547467;
        return r547468;
}

double f(double x, double y, double z, double t) {
        double r547469 = t;
        double r547470 = -7.237150244124864e+22;
        bool r547471 = r547469 <= r547470;
        double r547472 = x;
        double r547473 = z;
        double r547474 = r547472 - r547473;
        double r547475 = y;
        double r547476 = r547469 * r547475;
        double r547477 = r547474 * r547476;
        double r547478 = 1.7693630633187517e+28;
        bool r547479 = r547469 <= r547478;
        double r547480 = 1.0;
        double r547481 = pow(r547472, r547480);
        double r547482 = r547480 * r547481;
        double r547483 = -r547473;
        double r547484 = r547482 + r547483;
        double r547485 = r547469 * r547484;
        double r547486 = r547485 * r547475;
        double r547487 = fma(r547483, r547480, r547473);
        double r547488 = r547475 * r547487;
        double r547489 = r547488 * r547469;
        double r547490 = r547486 + r547489;
        double r547491 = r547475 * r547474;
        double r547492 = r547469 * r547491;
        double r547493 = r547479 ? r547490 : r547492;
        double r547494 = r547471 ? r547477 : r547493;
        return r547494;
}

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. Taylor expanded around inf 3.9

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

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

    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 pow1/334.4

      \[\leadsto \left(t \cdot \left(1 \cdot {\color{blue}{\left({x}^{\frac{1}{3}}\right)}}^{3} + \left(-z\right)\right)\right) \cdot y + \left(y \cdot \mathsf{fma}\left(-z, 1, z\right)\right) \cdot t\]
    13. Applied pow-pow1.9

      \[\leadsto \left(t \cdot \left(1 \cdot \color{blue}{{x}^{\left(\frac{1}{3} \cdot 3\right)}} + \left(-z\right)\right)\right) \cdot y + \left(y \cdot \mathsf{fma}\left(-z, 1, z\right)\right) \cdot t\]
    14. Simplified1.9

      \[\leadsto \left(t \cdot \left(1 \cdot {x}^{\color{blue}{1}} + \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)\\ \mathbf{elif}\;t \le 17693630633187516781772668928:\\ \;\;\;\;\left(t \cdot \left(1 \cdot {x}^{1} + \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))