Average Error: 7.3 → 1.6
Time: 18.6s
Precision: 64
\[\left(x \cdot y - z \cdot y\right) \cdot t\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot y \le -3.289691432454229072694311781383736379418 \cdot 10^{212} \lor \neg \left(x \cdot y - z \cdot y \le 4.13635306835415679283981035434619120167 \cdot 10^{151}\right):\\ \;\;\;\;y \cdot \left(t \cdot \left(x - z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot y - z \cdot y\right) \cdot t\\ \end{array}\]
\left(x \cdot y - z \cdot y\right) \cdot t
\begin{array}{l}
\mathbf{if}\;x \cdot y - z \cdot y \le -3.289691432454229072694311781383736379418 \cdot 10^{212} \lor \neg \left(x \cdot y - z \cdot y \le 4.13635306835415679283981035434619120167 \cdot 10^{151}\right):\\
\;\;\;\;y \cdot \left(t \cdot \left(x - z\right)\right)\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r341568 = x;
        double r341569 = y;
        double r341570 = r341568 * r341569;
        double r341571 = z;
        double r341572 = r341571 * r341569;
        double r341573 = r341570 - r341572;
        double r341574 = t;
        double r341575 = r341573 * r341574;
        return r341575;
}

double f(double x, double y, double z, double t) {
        double r341576 = x;
        double r341577 = y;
        double r341578 = r341576 * r341577;
        double r341579 = z;
        double r341580 = r341579 * r341577;
        double r341581 = r341578 - r341580;
        double r341582 = -3.289691432454229e+212;
        bool r341583 = r341581 <= r341582;
        double r341584 = 4.136353068354157e+151;
        bool r341585 = r341581 <= r341584;
        double r341586 = !r341585;
        bool r341587 = r341583 || r341586;
        double r341588 = t;
        double r341589 = r341576 - r341579;
        double r341590 = r341588 * r341589;
        double r341591 = r341577 * r341590;
        double r341592 = r341581 * r341588;
        double r341593 = r341587 ? r341591 : r341592;
        return r341593;
}

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.3
Target3.0
Herbie1.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 2 regimes
  2. if (- (* x y) (* z y)) < -3.289691432454229e+212 or 4.136353068354157e+151 < (- (* x y) (* z y))

    1. Initial program 25.5

      \[\left(x \cdot y - z \cdot y\right) \cdot t\]
    2. Using strategy rm
    3. Applied distribute-rgt-out--25.5

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

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

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

    if -3.289691432454229e+212 < (- (* x y) (* z y)) < 4.136353068354157e+151

    1. Initial program 1.7

      \[\left(x \cdot y - z \cdot y\right) \cdot t\]
  3. Recombined 2 regimes into one program.
  4. Final simplification1.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot y \le -3.289691432454229072694311781383736379418 \cdot 10^{212} \lor \neg \left(x \cdot y - z \cdot y \le 4.13635306835415679283981035434619120167 \cdot 10^{151}\right):\\ \;\;\;\;y \cdot \left(t \cdot \left(x - z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot y - z \cdot y\right) \cdot t\\ \end{array}\]

Reproduce

herbie shell --seed 2019304 +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.2318795828867769e-80) (* (* y t) (- x z)) (if (< t 2.5430670515648771e83) (* y (* t (- x z))) (* (* y (- x z)) t)))

  (* (- (* x y) (* z y)) t))