Average Error: 7.2 → 3.0
Time: 17.0s
Precision: 64
\[\left(x \cdot y - z \cdot y\right) \cdot t\]
\[\begin{array}{l} \mathbf{if}\;y \le -24528.73585804069443838670849800109863281:\\ \;\;\;\;\left(t \cdot y\right) \cdot \left(x - z\right)\\ \mathbf{elif}\;y \le 2.583080580921436072391451137817466644029 \cdot 10^{67}:\\ \;\;\;\;\left(y \cdot \left(x - z\right)\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\ \end{array}\]
\left(x \cdot y - z \cdot y\right) \cdot t
\begin{array}{l}
\mathbf{if}\;y \le -24528.73585804069443838670849800109863281:\\
\;\;\;\;\left(t \cdot y\right) \cdot \left(x - z\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r380190 = x;
        double r380191 = y;
        double r380192 = r380190 * r380191;
        double r380193 = z;
        double r380194 = r380193 * r380191;
        double r380195 = r380192 - r380194;
        double r380196 = t;
        double r380197 = r380195 * r380196;
        return r380197;
}

double f(double x, double y, double z, double t) {
        double r380198 = y;
        double r380199 = -24528.735858040694;
        bool r380200 = r380198 <= r380199;
        double r380201 = t;
        double r380202 = r380201 * r380198;
        double r380203 = x;
        double r380204 = z;
        double r380205 = r380203 - r380204;
        double r380206 = r380202 * r380205;
        double r380207 = 2.583080580921436e+67;
        bool r380208 = r380198 <= r380207;
        double r380209 = r380198 * r380205;
        double r380210 = r380209 * r380201;
        double r380211 = r380205 * r380201;
        double r380212 = r380198 * r380211;
        double r380213 = r380208 ? r380210 : r380212;
        double r380214 = r380200 ? r380206 : r380213;
        return r380214;
}

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.2
Target3.2
Herbie3.0
\[\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 < -24528.735858040694

    1. Initial program 15.9

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

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

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

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

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

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

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

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

    if -24528.735858040694 < y < 2.583080580921436e+67

    1. Initial program 2.4

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

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

    if 2.583080580921436e+67 < y

    1. Initial program 19.4

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

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

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

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

Reproduce

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