Average Error: 3.8 → 0.6
Time: 4.4s
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 -2.217051937980127926982818674661840685718 \cdot 10^{48}:\\ \;\;\;\;\left(0.3333333333333333148296162562473909929395 \cdot \frac{t}{z \cdot y} + x\right) - 0.3333333333333333148296162562473909929395 \cdot \frac{y}{z}\\ \mathbf{elif}\;t \le 1.374392757043330110386267311148160852221 \cdot 10^{-73}:\\ \;\;\;\;\left(x - \frac{\frac{y}{z}}{3}\right) + \frac{1}{z} \cdot \frac{\frac{t}{3}}{y}\\ \mathbf{else}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{{\left(3 \cdot \left(z \cdot y\right)\right)}^{1}}\\ \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 -2.217051937980127926982818674661840685718 \cdot 10^{48}:\\
\;\;\;\;\left(0.3333333333333333148296162562473909929395 \cdot \frac{t}{z \cdot y} + x\right) - 0.3333333333333333148296162562473909929395 \cdot \frac{y}{z}\\

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r824201 = x;
        double r824202 = y;
        double r824203 = z;
        double r824204 = 3.0;
        double r824205 = r824203 * r824204;
        double r824206 = r824202 / r824205;
        double r824207 = r824201 - r824206;
        double r824208 = t;
        double r824209 = r824205 * r824202;
        double r824210 = r824208 / r824209;
        double r824211 = r824207 + r824210;
        return r824211;
}

double f(double x, double y, double z, double t) {
        double r824212 = t;
        double r824213 = -2.217051937980128e+48;
        bool r824214 = r824212 <= r824213;
        double r824215 = 0.3333333333333333;
        double r824216 = z;
        double r824217 = y;
        double r824218 = r824216 * r824217;
        double r824219 = r824212 / r824218;
        double r824220 = r824215 * r824219;
        double r824221 = x;
        double r824222 = r824220 + r824221;
        double r824223 = r824217 / r824216;
        double r824224 = r824215 * r824223;
        double r824225 = r824222 - r824224;
        double r824226 = 1.3743927570433301e-73;
        bool r824227 = r824212 <= r824226;
        double r824228 = 3.0;
        double r824229 = r824223 / r824228;
        double r824230 = r824221 - r824229;
        double r824231 = 1.0;
        double r824232 = r824231 / r824216;
        double r824233 = r824212 / r824228;
        double r824234 = r824233 / r824217;
        double r824235 = r824232 * r824234;
        double r824236 = r824230 + r824235;
        double r824237 = r824216 * r824228;
        double r824238 = r824217 / r824237;
        double r824239 = r824221 - r824238;
        double r824240 = r824228 * r824218;
        double r824241 = pow(r824240, r824231);
        double r824242 = r824212 / r824241;
        double r824243 = r824239 + r824242;
        double r824244 = r824227 ? r824236 : r824243;
        double r824245 = r824214 ? r824225 : r824244;
        return r824245;
}

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.8
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 t < -2.217051937980128e+48

    1. Initial program 0.6

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

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

    if -2.217051937980128e+48 < t < 1.3743927570433301e-73

    1. Initial program 6.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.3

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

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

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

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

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

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

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

    if 1.3743927570433301e-73 < t

    1. Initial program 1.0

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

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

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

      \[\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-down1.0

      \[\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-down1.0

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -2.217051937980127926982818674661840685718 \cdot 10^{48}:\\ \;\;\;\;\left(0.3333333333333333148296162562473909929395 \cdot \frac{t}{z \cdot y} + x\right) - 0.3333333333333333148296162562473909929395 \cdot \frac{y}{z}\\ \mathbf{elif}\;t \le 1.374392757043330110386267311148160852221 \cdot 10^{-73}:\\ \;\;\;\;\left(x - \frac{\frac{y}{z}}{3}\right) + \frac{1}{z} \cdot \frac{\frac{t}{3}}{y}\\ \mathbf{else}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{{\left(3 \cdot \left(z \cdot y\right)\right)}^{1}}\\ \end{array}\]

Reproduce

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