Average Error: 3.5 → 0.9
Time: 2.9s
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 -4.1425510723146598 \cdot 10^{29}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{t}{z \cdot 3}}{y}\\ \mathbf{elif}\;z \cdot 3 \le 5.5644502692159849 \cdot 10^{100}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{1}{z} \cdot \frac{t}{3 \cdot y}\\ \mathbf{else}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{1}{\frac{z \cdot \left(3 \cdot y\right)}{t}}\\ \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 -4.1425510723146598 \cdot 10^{29}:\\
\;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{t}{z \cdot 3}}{y}\\

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r988489 = x;
        double r988490 = y;
        double r988491 = z;
        double r988492 = 3.0;
        double r988493 = r988491 * r988492;
        double r988494 = r988490 / r988493;
        double r988495 = r988489 - r988494;
        double r988496 = t;
        double r988497 = r988493 * r988490;
        double r988498 = r988496 / r988497;
        double r988499 = r988495 + r988498;
        return r988499;
}

double f(double x, double y, double z, double t) {
        double r988500 = z;
        double r988501 = 3.0;
        double r988502 = r988500 * r988501;
        double r988503 = -4.14255107231466e+29;
        bool r988504 = r988502 <= r988503;
        double r988505 = x;
        double r988506 = y;
        double r988507 = r988506 / r988502;
        double r988508 = r988505 - r988507;
        double r988509 = t;
        double r988510 = r988509 / r988502;
        double r988511 = r988510 / r988506;
        double r988512 = r988508 + r988511;
        double r988513 = 5.564450269215985e+100;
        bool r988514 = r988502 <= r988513;
        double r988515 = 1.0;
        double r988516 = r988515 / r988500;
        double r988517 = r988501 * r988506;
        double r988518 = r988509 / r988517;
        double r988519 = r988516 * r988518;
        double r988520 = r988508 + r988519;
        double r988521 = r988500 * r988517;
        double r988522 = r988521 / r988509;
        double r988523 = r988515 / r988522;
        double r988524 = r988508 + r988523;
        double r988525 = r988514 ? r988520 : r988524;
        double r988526 = r988504 ? r988512 : r988525;
        return r988526;
}

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.5
Target1.9
Herbie0.9
\[\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) < -4.14255107231466e+29

    1. Initial program 0.3

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

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

    if -4.14255107231466e+29 < (* z 3.0) < 5.564450269215985e+100

    1. Initial program 7.2

      \[\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*7.2

      \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\color{blue}{z \cdot \left(3 \cdot y\right)}}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity7.2

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

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

    if 5.564450269215985e+100 < (* z 3.0)

    1. Initial program 0.6

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

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

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

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

Reproduce

herbie shell --seed 2020025 
(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))))