Average Error: 3.9 → 0.9
Time: 10.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.679549677934962912371060912947000332007 \cdot 10^{-9}:\\ \;\;\;\;\frac{\frac{t}{3}}{y \cdot z} + \left(x - 0.3333333333333333148296162562473909929395 \cdot \frac{y}{z}\right)\\ \mathbf{elif}\;z \cdot 3 \le 1.988546582597582853711732660366369539647 \cdot 10^{129}:\\ \;\;\;\;\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) + 0.3333333333333333148296162562473909929395 \cdot \frac{\frac{t}{z}}{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 -1.679549677934962912371060912947000332007 \cdot 10^{-9}:\\
\;\;\;\;\frac{\frac{t}{3}}{y \cdot z} + \left(x - 0.3333333333333333148296162562473909929395 \cdot \frac{y}{z}\right)\\

\mathbf{elif}\;z \cdot 3 \le 1.988546582597582853711732660366369539647 \cdot 10^{129}:\\
\;\;\;\;\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) + 0.3333333333333333148296162562473909929395 \cdot \frac{\frac{t}{z}}{y}\\

\end{array}
double f(double x, double y, double z, double t) {
        double r521205 = x;
        double r521206 = y;
        double r521207 = z;
        double r521208 = 3.0;
        double r521209 = r521207 * r521208;
        double r521210 = r521206 / r521209;
        double r521211 = r521205 - r521210;
        double r521212 = t;
        double r521213 = r521209 * r521206;
        double r521214 = r521212 / r521213;
        double r521215 = r521211 + r521214;
        return r521215;
}

double f(double x, double y, double z, double t) {
        double r521216 = z;
        double r521217 = 3.0;
        double r521218 = r521216 * r521217;
        double r521219 = -1.679549677934963e-09;
        bool r521220 = r521218 <= r521219;
        double r521221 = t;
        double r521222 = r521221 / r521217;
        double r521223 = y;
        double r521224 = r521223 * r521216;
        double r521225 = r521222 / r521224;
        double r521226 = x;
        double r521227 = 0.3333333333333333;
        double r521228 = r521223 / r521216;
        double r521229 = r521227 * r521228;
        double r521230 = r521226 - r521229;
        double r521231 = r521225 + r521230;
        double r521232 = 1.988546582597583e+129;
        bool r521233 = r521218 <= r521232;
        double r521234 = r521223 / r521218;
        double r521235 = r521226 - r521234;
        double r521236 = 1.0;
        double r521237 = r521236 / r521218;
        double r521238 = r521221 / r521223;
        double r521239 = r521237 * r521238;
        double r521240 = r521235 + r521239;
        double r521241 = r521221 / r521216;
        double r521242 = r521241 / r521223;
        double r521243 = r521227 * r521242;
        double r521244 = r521235 + r521243;
        double r521245 = r521233 ? r521240 : r521244;
        double r521246 = r521220 ? r521231 : r521245;
        return r521246;
}

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.9
Target1.7
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) < -1.679549677934963e-09

    1. Initial program 0.5

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

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

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

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

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

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

      \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{{\color{blue}{\left(3 \cdot \left(z \cdot y\right)\right)}}^{1}}\]
    9. Using strategy rm
    10. Applied unpow-prod-down0.5

      \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\color{blue}{{3}^{1} \cdot {\left(z \cdot y\right)}^{1}}}\]
    11. Applied associate-/r*0.5

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

      \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \frac{\color{blue}{\frac{t}{3}}}{{\left(z \cdot y\right)}^{1}}\]
    13. Taylor expanded around 0 0.5

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

    if -1.679549677934963e-09 < (* z 3.0) < 1.988546582597583e+129

    1. Initial program 7.9

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

      \[\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-frac1.1

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

    if 1.988546582597583e+129 < (* z 3.0)

    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 pow10.4

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

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

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

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

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

      \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{{\color{blue}{\left(3 \cdot \left(z \cdot y\right)\right)}}^{1}}\]
    9. Using strategy rm
    10. Applied unpow-prod-down0.4

      \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\color{blue}{{3}^{1} \cdot {\left(z \cdot y\right)}^{1}}}\]
    11. Applied associate-/r*0.5

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

      \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \frac{\color{blue}{\frac{t}{3}}}{{\left(z \cdot y\right)}^{1}}\]
    13. Taylor expanded around 0 0.5

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot 3 \le -1.679549677934962912371060912947000332007 \cdot 10^{-9}:\\ \;\;\;\;\frac{\frac{t}{3}}{y \cdot z} + \left(x - 0.3333333333333333148296162562473909929395 \cdot \frac{y}{z}\right)\\ \mathbf{elif}\;z \cdot 3 \le 1.988546582597582853711732660366369539647 \cdot 10^{129}:\\ \;\;\;\;\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) + 0.3333333333333333148296162562473909929395 \cdot \frac{\frac{t}{z}}{y}\\ \end{array}\]

Reproduce

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