Average Error: 3.7 → 0.3
Time: 3.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 -173.680758903605664:\\ \;\;\;\;\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 2.47802346187223619 \cdot 10^{-26}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{1}{z \cdot 3} \cdot \frac{t}{y}\\ \mathbf{else}:\\ \;\;\;\;\left(x - 0.333333333333333315 \cdot \frac{y}{z}\right) + \frac{t}{\left(z \cdot 3\right) \cdot 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 -173.680758903605664:\\
\;\;\;\;\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 2.47802346187223619 \cdot 10^{-26}:\\
\;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{1}{z \cdot 3} \cdot \frac{t}{y}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r885119 = x;
        double r885120 = y;
        double r885121 = z;
        double r885122 = 3.0;
        double r885123 = r885121 * r885122;
        double r885124 = r885120 / r885123;
        double r885125 = r885119 - r885124;
        double r885126 = t;
        double r885127 = r885123 * r885120;
        double r885128 = r885126 / r885127;
        double r885129 = r885125 + r885128;
        return r885129;
}

double f(double x, double y, double z, double t) {
        double r885130 = z;
        double r885131 = 3.0;
        double r885132 = r885130 * r885131;
        double r885133 = -173.68075890360566;
        bool r885134 = r885132 <= r885133;
        double r885135 = x;
        double r885136 = y;
        double r885137 = r885136 / r885132;
        double r885138 = r885135 - r885137;
        double r885139 = 1.0;
        double r885140 = r885132 * r885136;
        double r885141 = t;
        double r885142 = r885140 / r885141;
        double r885143 = r885139 / r885142;
        double r885144 = r885138 + r885143;
        double r885145 = 2.4780234618722362e-26;
        bool r885146 = r885132 <= r885145;
        double r885147 = r885139 / r885132;
        double r885148 = r885141 / r885136;
        double r885149 = r885147 * r885148;
        double r885150 = r885138 + r885149;
        double r885151 = 0.3333333333333333;
        double r885152 = r885136 / r885130;
        double r885153 = r885151 * r885152;
        double r885154 = r885135 - r885153;
        double r885155 = r885141 / r885140;
        double r885156 = r885154 + r885155;
        double r885157 = r885146 ? r885150 : r885156;
        double r885158 = r885134 ? r885144 : r885157;
        return r885158;
}

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.7
Target1.5
Herbie0.3
\[\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) < -173.68075890360566

    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 -173.68075890360566 < (* z 3.0) < 2.4780234618722362e-26

    1. Initial program 11.1

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

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

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

    if 2.4780234618722362e-26 < (* z 3.0)

    1. Initial program 0.3

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

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

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

Reproduce

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