Average Error: 7.2 → 3.0
Time: 17.1s
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 r354400 = x;
        double r354401 = y;
        double r354402 = r354400 * r354401;
        double r354403 = z;
        double r354404 = r354403 * r354401;
        double r354405 = r354402 - r354404;
        double r354406 = t;
        double r354407 = r354405 * r354406;
        return r354407;
}

double f(double x, double y, double z, double t) {
        double r354408 = y;
        double r354409 = -24528.735858040694;
        bool r354410 = r354408 <= r354409;
        double r354411 = t;
        double r354412 = r354411 * r354408;
        double r354413 = x;
        double r354414 = z;
        double r354415 = r354413 - r354414;
        double r354416 = r354412 * r354415;
        double r354417 = 2.583080580921436e+67;
        bool r354418 = r354408 <= r354417;
        double r354419 = r354408 * r354415;
        double r354420 = r354419 * r354411;
        double r354421 = r354415 * r354411;
        double r354422 = r354408 * r354421;
        double r354423 = r354418 ? r354420 : r354422;
        double r354424 = r354410 ? r354416 : r354423;
        return r354424;
}

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))