Average Error: 3.6 → 0.8
Time: 19.2s
Precision: 64
\[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\]
\[\begin{array}{l} \mathbf{if}\;t \le -5.402687696763889505291682907717896167482 \cdot 10^{54}:\\ \;\;\;\;\frac{t}{z \cdot \left(3 \cdot y\right)} + \left(x - \frac{y}{z \cdot 3}\right)\\ \mathbf{elif}\;t \le 1.835348449183070959810035931972584701578 \cdot 10^{-76}:\\ \;\;\;\;\frac{\frac{t}{y}}{z \cdot 3} + \left(x - \frac{y}{z \cdot 3}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{t}{z \cdot 3}}{y} + \left(x - \frac{\frac{y}{z}}{3}\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}\;t \le -5.402687696763889505291682907717896167482 \cdot 10^{54}:\\
\;\;\;\;\frac{t}{z \cdot \left(3 \cdot y\right)} + \left(x - \frac{y}{z \cdot 3}\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r506459 = x;
        double r506460 = y;
        double r506461 = z;
        double r506462 = 3.0;
        double r506463 = r506461 * r506462;
        double r506464 = r506460 / r506463;
        double r506465 = r506459 - r506464;
        double r506466 = t;
        double r506467 = r506463 * r506460;
        double r506468 = r506466 / r506467;
        double r506469 = r506465 + r506468;
        return r506469;
}

double f(double x, double y, double z, double t) {
        double r506470 = t;
        double r506471 = -5.4026876967638895e+54;
        bool r506472 = r506470 <= r506471;
        double r506473 = z;
        double r506474 = 3.0;
        double r506475 = y;
        double r506476 = r506474 * r506475;
        double r506477 = r506473 * r506476;
        double r506478 = r506470 / r506477;
        double r506479 = x;
        double r506480 = r506473 * r506474;
        double r506481 = r506475 / r506480;
        double r506482 = r506479 - r506481;
        double r506483 = r506478 + r506482;
        double r506484 = 1.835348449183071e-76;
        bool r506485 = r506470 <= r506484;
        double r506486 = r506470 / r506475;
        double r506487 = r506486 / r506480;
        double r506488 = r506487 + r506482;
        double r506489 = r506470 / r506480;
        double r506490 = r506489 / r506475;
        double r506491 = r506475 / r506473;
        double r506492 = r506491 / r506474;
        double r506493 = r506479 - r506492;
        double r506494 = r506490 + r506493;
        double r506495 = r506485 ? r506488 : r506494;
        double r506496 = r506472 ? r506483 : r506495;
        return r506496;
}

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.6
Herbie0.8
\[\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{t}{z \cdot 3}}{y}\]

Derivation

  1. Split input into 3 regimes
  2. if t < -5.4026876967638895e+54

    1. Initial program 0.7

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

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

      \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot \color{blue}{{3}^{1}}\right) \cdot {y}^{1}}\]
    5. Applied pow10.7

      \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(\color{blue}{{z}^{1}} \cdot {3}^{1}\right) \cdot {y}^{1}}\]
    6. Applied pow-prod-down0.7

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

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

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

    if -5.4026876967638895e+54 < t < 1.835348449183071e-76

    1. Initial program 5.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-/r*1.0

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

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

      \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \color{blue}{1 \cdot \frac{\frac{t}{3 \cdot z}}{y}}\]
    7. Applied *-un-lft-identity1.0

      \[\leadsto \color{blue}{1 \cdot \left(x - \frac{y}{z \cdot 3}\right)} + 1 \cdot \frac{\frac{t}{3 \cdot z}}{y}\]
    8. Applied distribute-lft-out1.0

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

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

    if 1.835348449183071e-76 < t

    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-/r*1.8

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

      \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \frac{\color{blue}{\frac{t}{3 \cdot z}}}{y}\]
    5. Using strategy rm
    6. Applied associate-/r*1.8

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -5.402687696763889505291682907717896167482 \cdot 10^{54}:\\ \;\;\;\;\frac{t}{z \cdot \left(3 \cdot y\right)} + \left(x - \frac{y}{z \cdot 3}\right)\\ \mathbf{elif}\;t \le 1.835348449183070959810035931972584701578 \cdot 10^{-76}:\\ \;\;\;\;\frac{\frac{t}{y}}{z \cdot 3} + \left(x - \frac{y}{z \cdot 3}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{t}{z \cdot 3}}{y} + \left(x - \frac{\frac{y}{z}}{3}\right)\\ \end{array}\]

Reproduce

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

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

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