Average Error: 7.1 → 0.3
Time: 4.1s
Precision: 64
\[\left(x \cdot y - z \cdot y\right) \cdot t\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot y \le -1.199268204572286292733810783249938879228 \cdot 10^{262}:\\ \;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\ \mathbf{elif}\;x \cdot y - z \cdot y \le -1.146408495273293263666975816516032122747 \cdot 10^{-196}:\\ \;\;\;\;\left(x \cdot y - z \cdot y\right) \cdot t\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 0.0:\\ \;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 5.196326024148916923916761985956399523298 \cdot 10^{264}:\\ \;\;\;\;\left(x \cdot y - z \cdot y\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;{\left(\left(t \cdot y\right) \cdot \left(x - z\right)\right)}^{1}\\ \end{array}\]
\left(x \cdot y - z \cdot y\right) \cdot t
\begin{array}{l}
\mathbf{if}\;x \cdot y - z \cdot y \le -1.199268204572286292733810783249938879228 \cdot 10^{262}:\\
\;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\

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

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

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r671564 = x;
        double r671565 = y;
        double r671566 = r671564 * r671565;
        double r671567 = z;
        double r671568 = r671567 * r671565;
        double r671569 = r671566 - r671568;
        double r671570 = t;
        double r671571 = r671569 * r671570;
        return r671571;
}

double f(double x, double y, double z, double t) {
        double r671572 = x;
        double r671573 = y;
        double r671574 = r671572 * r671573;
        double r671575 = z;
        double r671576 = r671575 * r671573;
        double r671577 = r671574 - r671576;
        double r671578 = -1.1992682045722863e+262;
        bool r671579 = r671577 <= r671578;
        double r671580 = r671572 - r671575;
        double r671581 = t;
        double r671582 = r671580 * r671581;
        double r671583 = r671573 * r671582;
        double r671584 = -1.1464084952732933e-196;
        bool r671585 = r671577 <= r671584;
        double r671586 = r671577 * r671581;
        double r671587 = 0.0;
        bool r671588 = r671577 <= r671587;
        double r671589 = 5.196326024148917e+264;
        bool r671590 = r671577 <= r671589;
        double r671591 = r671581 * r671573;
        double r671592 = r671591 * r671580;
        double r671593 = 1.0;
        double r671594 = pow(r671592, r671593);
        double r671595 = r671590 ? r671586 : r671594;
        double r671596 = r671588 ? r671583 : r671595;
        double r671597 = r671585 ? r671586 : r671596;
        double r671598 = r671579 ? r671583 : r671597;
        return r671598;
}

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.2
Herbie0.3
\[\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 (- (* x y) (* z y)) < -1.1992682045722863e+262 or -1.1464084952732933e-196 < (- (* x y) (* z y)) < 0.0

    1. Initial program 23.7

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

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

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

    if -1.1992682045722863e+262 < (- (* x y) (* z y)) < -1.1464084952732933e-196 or 0.0 < (- (* x y) (* z y)) < 5.196326024148917e+264

    1. Initial program 0.6

      \[\left(x \cdot y - z \cdot y\right) \cdot t\]

    if 5.196326024148917e+264 < (- (* x y) (* z y))

    1. Initial program 46.7

      \[\left(x \cdot y - z \cdot y\right) \cdot t\]
    2. Using strategy rm
    3. Applied pow146.7

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot y \le -1.199268204572286292733810783249938879228 \cdot 10^{262}:\\ \;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\ \mathbf{elif}\;x \cdot y - z \cdot y \le -1.146408495273293263666975816516032122747 \cdot 10^{-196}:\\ \;\;\;\;\left(x \cdot y - z \cdot y\right) \cdot t\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 0.0:\\ \;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 5.196326024148916923916761985956399523298 \cdot 10^{264}:\\ \;\;\;\;\left(x \cdot y - z \cdot y\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;{\left(\left(t \cdot y\right) \cdot \left(x - z\right)\right)}^{1}\\ \end{array}\]

Reproduce

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