Average Error: 3.6 → 0.6
Time: 4.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 -2.46496578386789013 \cdot 10^{-76} \lor \neg \left(t \le 0.308744324160906747\right):\\ \;\;\;\;\left(x - \frac{\frac{y}{z}}{3}\right) + 0.333333333333333315 \cdot \frac{t}{z \cdot y}\\ \mathbf{else}:\\ \;\;\;\;\left(x - \frac{1}{z} \cdot \frac{y}{3}\right) + \frac{0.333333333333333315}{z} \cdot \frac{t}{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}\;t \le -2.46496578386789013 \cdot 10^{-76} \lor \neg \left(t \le 0.308744324160906747\right):\\
\;\;\;\;\left(x - \frac{\frac{y}{z}}{3}\right) + 0.333333333333333315 \cdot \frac{t}{z \cdot y}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r792800 = x;
        double r792801 = y;
        double r792802 = z;
        double r792803 = 3.0;
        double r792804 = r792802 * r792803;
        double r792805 = r792801 / r792804;
        double r792806 = r792800 - r792805;
        double r792807 = t;
        double r792808 = r792804 * r792801;
        double r792809 = r792807 / r792808;
        double r792810 = r792806 + r792809;
        return r792810;
}

double f(double x, double y, double z, double t) {
        double r792811 = t;
        double r792812 = -2.46496578386789e-76;
        bool r792813 = r792811 <= r792812;
        double r792814 = 0.30874432416090675;
        bool r792815 = r792811 <= r792814;
        double r792816 = !r792815;
        bool r792817 = r792813 || r792816;
        double r792818 = x;
        double r792819 = y;
        double r792820 = z;
        double r792821 = r792819 / r792820;
        double r792822 = 3.0;
        double r792823 = r792821 / r792822;
        double r792824 = r792818 - r792823;
        double r792825 = 0.3333333333333333;
        double r792826 = r792820 * r792819;
        double r792827 = r792811 / r792826;
        double r792828 = r792825 * r792827;
        double r792829 = r792824 + r792828;
        double r792830 = 1.0;
        double r792831 = r792830 / r792820;
        double r792832 = r792819 / r792822;
        double r792833 = r792831 * r792832;
        double r792834 = r792818 - r792833;
        double r792835 = r792825 / r792820;
        double r792836 = r792811 / r792819;
        double r792837 = r792835 * r792836;
        double r792838 = r792834 + r792837;
        double r792839 = r792817 ? r792829 : r792838;
        return r792839;
}

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

Derivation

  1. Split input into 2 regimes
  2. if t < -2.46496578386789e-76 or 0.30874432416090675 < t

    1. Initial program 0.8

      \[\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-identity0.8

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

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

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

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

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

    if -2.46496578386789e-76 < t < 0.30874432416090675

    1. Initial program 6.4

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

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

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

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

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

      \[\leadsto \left(x - \frac{1}{z} \cdot \frac{y}{3}\right) + 0.333333333333333315 \cdot \color{blue}{\left(\frac{1}{z} \cdot \frac{t}{y}\right)}\]
    9. Applied associate-*r*0.2

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -2.46496578386789013 \cdot 10^{-76} \lor \neg \left(t \le 0.308744324160906747\right):\\ \;\;\;\;\left(x - \frac{\frac{y}{z}}{3}\right) + 0.333333333333333315 \cdot \frac{t}{z \cdot y}\\ \mathbf{else}:\\ \;\;\;\;\left(x - \frac{1}{z} \cdot \frac{y}{3}\right) + \frac{0.333333333333333315}{z} \cdot \frac{t}{y}\\ \end{array}\]

Reproduce

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