Average Error: 7.1 → 3.1
Time: 11.7s
Precision: 64
\[\left(x \cdot y - z \cdot y\right) \cdot t\]
\[\begin{array}{l} \mathbf{if}\;y \le -1.30679209408064958707058338211786093679 \cdot 10^{99}:\\ \;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\ \mathbf{elif}\;y \le 3.71994351214166424029575806263346983645 \cdot 10^{-65}:\\ \;\;\;\;\left(y \cdot \left(x - z\right)\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;\left(x - z\right) \cdot \left(t \cdot y\right)\\ \end{array}\]
\left(x \cdot y - z \cdot y\right) \cdot t
\begin{array}{l}
\mathbf{if}\;y \le -1.30679209408064958707058338211786093679 \cdot 10^{99}:\\
\;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\

\mathbf{elif}\;y \le 3.71994351214166424029575806263346983645 \cdot 10^{-65}:\\
\;\;\;\;\left(y \cdot \left(x - z\right)\right) \cdot t\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r583504 = x;
        double r583505 = y;
        double r583506 = r583504 * r583505;
        double r583507 = z;
        double r583508 = r583507 * r583505;
        double r583509 = r583506 - r583508;
        double r583510 = t;
        double r583511 = r583509 * r583510;
        return r583511;
}

double f(double x, double y, double z, double t) {
        double r583512 = y;
        double r583513 = -1.3067920940806496e+99;
        bool r583514 = r583512 <= r583513;
        double r583515 = x;
        double r583516 = z;
        double r583517 = r583515 - r583516;
        double r583518 = t;
        double r583519 = r583517 * r583518;
        double r583520 = r583512 * r583519;
        double r583521 = 3.7199435121416642e-65;
        bool r583522 = r583512 <= r583521;
        double r583523 = r583512 * r583517;
        double r583524 = r583523 * r583518;
        double r583525 = r583518 * r583512;
        double r583526 = r583517 * r583525;
        double r583527 = r583522 ? r583524 : r583526;
        double r583528 = r583514 ? r583520 : r583527;
        return r583528;
}

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

Original7.1
Target3.1
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 y < -1.3067920940806496e+99

    1. Initial program 21.6

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

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

      \[\leadsto \left(y \cdot \left(x - z\right)\right) \cdot \color{blue}{{t}^{1}}\]
    5. Applied pow121.6

      \[\leadsto \left(y \cdot \color{blue}{{\left(x - z\right)}^{1}}\right) \cdot {t}^{1}\]
    6. Applied pow121.6

      \[\leadsto \left(\color{blue}{{y}^{1}} \cdot {\left(x - z\right)}^{1}\right) \cdot {t}^{1}\]
    7. Applied pow-prod-down21.6

      \[\leadsto \color{blue}{{\left(y \cdot \left(x - z\right)\right)}^{1}} \cdot {t}^{1}\]
    8. Applied pow-prod-down21.6

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

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

    if -1.3067920940806496e+99 < y < 3.7199435121416642e-65

    1. Initial program 2.6

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

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

    if 3.7199435121416642e-65 < y

    1. Initial program 12.1

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

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

      \[\leadsto \left(y \cdot \left(x - z\right)\right) \cdot \color{blue}{{t}^{1}}\]
    5. Applied pow112.1

      \[\leadsto \left(y \cdot \color{blue}{{\left(x - z\right)}^{1}}\right) \cdot {t}^{1}\]
    6. Applied pow112.1

      \[\leadsto \left(\color{blue}{{y}^{1}} \cdot {\left(x - z\right)}^{1}\right) \cdot {t}^{1}\]
    7. Applied pow-prod-down12.1

      \[\leadsto \color{blue}{{\left(y \cdot \left(x - z\right)\right)}^{1}} \cdot {t}^{1}\]
    8. Applied pow-prod-down12.1

      \[\leadsto \color{blue}{{\left(\left(y \cdot \left(x - z\right)\right) \cdot t\right)}^{1}}\]
    9. Simplified2.8

      \[\leadsto {\color{blue}{\left(y \cdot \left(\left(x - z\right) \cdot t\right)\right)}}^{1}\]
    10. Using strategy rm
    11. Applied add-cube-cbrt3.8

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

      \[\leadsto {\left(\color{blue}{\left(\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \sqrt[3]{y}\right)} \cdot \left(\left(\sqrt[3]{\left(x - z\right) \cdot t} \cdot \sqrt[3]{\left(x - z\right) \cdot t}\right) \cdot \sqrt[3]{\left(x - z\right) \cdot t}\right)\right)}^{1}\]
    14. Applied associate-*l*4.1

      \[\leadsto {\color{blue}{\left(\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \left(\sqrt[3]{y} \cdot \left(\left(\sqrt[3]{\left(x - z\right) \cdot t} \cdot \sqrt[3]{\left(x - z\right) \cdot t}\right) \cdot \sqrt[3]{\left(x - z\right) \cdot t}\right)\right)\right)}}^{1}\]
    15. Simplified3.8

      \[\leadsto {\left(\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \color{blue}{\left(\left(\left(x - z\right) \cdot t\right) \cdot \sqrt[3]{y}\right)}\right)}^{1}\]
    16. Taylor expanded around inf 12.1

      \[\leadsto {\color{blue}{\left(t \cdot \left(x \cdot y\right) - t \cdot \left(z \cdot y\right)\right)}}^{1}\]
    17. Simplified3.7

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -1.30679209408064958707058338211786093679 \cdot 10^{99}:\\ \;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\ \mathbf{elif}\;y \le 3.71994351214166424029575806263346983645 \cdot 10^{-65}:\\ \;\;\;\;\left(y \cdot \left(x - z\right)\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;\left(x - z\right) \cdot \left(t \cdot y\right)\\ \end{array}\]

Reproduce

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