Average Error: 3.6 → 0.6
Time: 5.6s
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 -1.47025786267833131 \cdot 10^{34}:\\ \;\;\;\;\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 5.67346849327476735 \cdot 10^{-85}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{1}{z \cdot 3} \cdot \frac{t}{y}\\ \mathbf{else}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{z \cdot \left(3 \cdot y\right)}\\ \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 -1.47025786267833131 \cdot 10^{34}:\\
\;\;\;\;\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 5.67346849327476735 \cdot 10^{-85}:\\
\;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{1}{z \cdot 3} \cdot \frac{t}{y}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r878503 = x;
        double r878504 = y;
        double r878505 = z;
        double r878506 = 3.0;
        double r878507 = r878505 * r878506;
        double r878508 = r878504 / r878507;
        double r878509 = r878503 - r878508;
        double r878510 = t;
        double r878511 = r878507 * r878504;
        double r878512 = r878510 / r878511;
        double r878513 = r878509 + r878512;
        return r878513;
}

double f(double x, double y, double z, double t) {
        double r878514 = z;
        double r878515 = 3.0;
        double r878516 = r878514 * r878515;
        double r878517 = -1.4702578626783313e+34;
        bool r878518 = r878516 <= r878517;
        double r878519 = x;
        double r878520 = y;
        double r878521 = r878520 / r878516;
        double r878522 = r878519 - r878521;
        double r878523 = 1.0;
        double r878524 = r878516 * r878520;
        double r878525 = t;
        double r878526 = r878524 / r878525;
        double r878527 = r878523 / r878526;
        double r878528 = r878522 + r878527;
        double r878529 = 5.673468493274767e-85;
        bool r878530 = r878516 <= r878529;
        double r878531 = r878523 / r878516;
        double r878532 = r878525 / r878520;
        double r878533 = r878531 * r878532;
        double r878534 = r878522 + r878533;
        double r878535 = r878515 * r878520;
        double r878536 = r878514 * r878535;
        double r878537 = r878525 / r878536;
        double r878538 = r878522 + r878537;
        double r878539 = r878530 ? r878534 : r878538;
        double r878540 = r878518 ? r878528 : r878539;
        return r878540;
}

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.6
Target1.9
Herbie0.6
\[\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) < -1.4702578626783313e+34

    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 -1.4702578626783313e+34 < (* z 3.0) < 5.673468493274767e-85

    1. Initial program 10.5

      \[\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-identity10.5

      \[\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.4

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

    if 5.673468493274767e-85 < (* z 3.0)

    1. Initial program 0.9

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\]
    2. Using strategy rm
    3. Applied associate-*l*0.9

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot 3 \le -1.47025786267833131 \cdot 10^{34}:\\ \;\;\;\;\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 5.67346849327476735 \cdot 10^{-85}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{1}{z \cdot 3} \cdot \frac{t}{y}\\ \mathbf{else}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{z \cdot \left(3 \cdot y\right)}\\ \end{array}\]

Reproduce

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