Average Error: 3.7 → 0.3
Time: 4.1s
Precision: 64
\[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\]
\[\begin{array}{l} \mathbf{if}\;z \cdot 3 \le -173.680758903605664:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{1}{\frac{\left(z \cdot 3\right) \cdot y}{t}}\\ \mathbf{elif}\;z \cdot 3 \le 2.47802346187223619 \cdot 10^{-26}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{1}{z \cdot 3} \cdot \frac{t}{y}\\ \mathbf{else}:\\ \;\;\;\;\left(x - 0.333333333333333315 \cdot \frac{y}{z}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\\ \end{array}\]
\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}
\begin{array}{l}
\mathbf{if}\;z \cdot 3 \le -173.680758903605664:\\
\;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{1}{\frac{\left(z \cdot 3\right) \cdot y}{t}}\\

\mathbf{elif}\;z \cdot 3 \le 2.47802346187223619 \cdot 10^{-26}:\\
\;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{1}{z \cdot 3} \cdot \frac{t}{y}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r721711 = x;
        double r721712 = y;
        double r721713 = z;
        double r721714 = 3.0;
        double r721715 = r721713 * r721714;
        double r721716 = r721712 / r721715;
        double r721717 = r721711 - r721716;
        double r721718 = t;
        double r721719 = r721715 * r721712;
        double r721720 = r721718 / r721719;
        double r721721 = r721717 + r721720;
        return r721721;
}

double f(double x, double y, double z, double t) {
        double r721722 = z;
        double r721723 = 3.0;
        double r721724 = r721722 * r721723;
        double r721725 = -173.68075890360566;
        bool r721726 = r721724 <= r721725;
        double r721727 = x;
        double r721728 = y;
        double r721729 = r721728 / r721724;
        double r721730 = r721727 - r721729;
        double r721731 = 1.0;
        double r721732 = r721724 * r721728;
        double r721733 = t;
        double r721734 = r721732 / r721733;
        double r721735 = r721731 / r721734;
        double r721736 = r721730 + r721735;
        double r721737 = 2.4780234618722362e-26;
        bool r721738 = r721724 <= r721737;
        double r721739 = r721731 / r721724;
        double r721740 = r721733 / r721728;
        double r721741 = r721739 * r721740;
        double r721742 = r721730 + r721741;
        double r721743 = 0.3333333333333333;
        double r721744 = r721728 / r721722;
        double r721745 = r721743 * r721744;
        double r721746 = r721727 - r721745;
        double r721747 = r721733 / r721732;
        double r721748 = r721746 + r721747;
        double r721749 = r721738 ? r721742 : r721748;
        double r721750 = r721726 ? r721736 : r721749;
        return r721750;
}

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

Original3.7
Target1.5
Herbie0.3
\[\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{t}{z \cdot 3}}{y}\]

Derivation

  1. Split input into 3 regimes
  2. if (* z 3.0) < -173.68075890360566

    1. Initial program 0.4

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\]
    2. Using strategy rm
    3. Applied clear-num0.4

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

    if -173.68075890360566 < (* z 3.0) < 2.4780234618722362e-26

    1. Initial program 11.1

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity11.1

      \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \frac{\color{blue}{1 \cdot t}}{\left(z \cdot 3\right) \cdot y}\]
    4. Applied times-frac0.3

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

    if 2.4780234618722362e-26 < (* z 3.0)

    1. Initial program 0.3

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\]
    2. Taylor expanded around 0 0.3

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot 3 \le -173.680758903605664:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{1}{\frac{\left(z \cdot 3\right) \cdot y}{t}}\\ \mathbf{elif}\;z \cdot 3 \le 2.47802346187223619 \cdot 10^{-26}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{1}{z \cdot 3} \cdot \frac{t}{y}\\ \mathbf{else}:\\ \;\;\;\;\left(x - 0.333333333333333315 \cdot \frac{y}{z}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\\ \end{array}\]

Reproduce

herbie shell --seed 2020089 +o rules:numerics
(FPCore (x y z t)
  :name "Diagrams.Solve.Polynomial:cubForm  from diagrams-solve-0.1, H"
  :precision binary64

  :herbie-target
  (+ (- x (/ y (* z 3))) (/ (/ t (* z 3)) y))

  (+ (- x (/ y (* z 3))) (/ t (* (* z 3) y))))