Average Error: 7.2 → 2.7
Time: 45.2s
Precision: 64
\[\left(x \cdot y - z \cdot y\right) \cdot t\]
\[\begin{array}{l} \mathbf{if}\;t \le -1997863461319427059803765080064:\\ \;\;\;\;\left(y \cdot t\right) \cdot \left(x - z\right)\\ \mathbf{elif}\;t \le 6.525842968778453615516463397980179254263 \cdot 10^{45}:\\ \;\;\;\;\left(\left(x - z\right) \cdot t\right) \cdot y\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(\left(x - z\right) \cdot y\right)\\ \end{array}\]
\left(x \cdot y - z \cdot y\right) \cdot t
\begin{array}{l}
\mathbf{if}\;t \le -1997863461319427059803765080064:\\
\;\;\;\;\left(y \cdot t\right) \cdot \left(x - z\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r22312098 = x;
        double r22312099 = y;
        double r22312100 = r22312098 * r22312099;
        double r22312101 = z;
        double r22312102 = r22312101 * r22312099;
        double r22312103 = r22312100 - r22312102;
        double r22312104 = t;
        double r22312105 = r22312103 * r22312104;
        return r22312105;
}

double f(double x, double y, double z, double t) {
        double r22312106 = t;
        double r22312107 = -1.997863461319427e+30;
        bool r22312108 = r22312106 <= r22312107;
        double r22312109 = y;
        double r22312110 = r22312109 * r22312106;
        double r22312111 = x;
        double r22312112 = z;
        double r22312113 = r22312111 - r22312112;
        double r22312114 = r22312110 * r22312113;
        double r22312115 = 6.525842968778454e+45;
        bool r22312116 = r22312106 <= r22312115;
        double r22312117 = r22312113 * r22312106;
        double r22312118 = r22312117 * r22312109;
        double r22312119 = r22312113 * r22312109;
        double r22312120 = r22312106 * r22312119;
        double r22312121 = r22312116 ? r22312118 : r22312120;
        double r22312122 = r22312108 ? r22312114 : r22312121;
        return r22312122;
}

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.0
Herbie2.7
\[\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 < -1.997863461319427e+30

    1. Initial program 3.5

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

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

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

    if -1.997863461319427e+30 < t < 6.525842968778454e+45

    1. Initial program 8.7

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

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

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

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

    if 6.525842968778454e+45 < t

    1. Initial program 3.8

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

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

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

Reproduce

herbie shell --seed 2019200 +o rules:numerics
(FPCore (x y z t)
  :name "Linear.Projection:inverseInfinitePerspective from linear-1.19.1.3"

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