Average Error: 3.6 → 0.8
Time: 3.9s
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 -6.2439806477432755 \cdot 10^{-55}:\\ \;\;\;\;\left(x - \frac{\frac{y}{z}}{3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\\ \mathbf{elif}\;z \cdot 3 \le 2.1876294926720047 \cdot 10^{119}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{1}{z} \cdot \frac{\frac{t}{3}}{y}\\ \mathbf{else}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + 0.333333333333333315 \cdot \frac{t}{z \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 -6.2439806477432755 \cdot 10^{-55}:\\
\;\;\;\;\left(x - \frac{\frac{y}{z}}{3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\\

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r753732 = x;
        double r753733 = y;
        double r753734 = z;
        double r753735 = 3.0;
        double r753736 = r753734 * r753735;
        double r753737 = r753733 / r753736;
        double r753738 = r753732 - r753737;
        double r753739 = t;
        double r753740 = r753736 * r753733;
        double r753741 = r753739 / r753740;
        double r753742 = r753738 + r753741;
        return r753742;
}

double f(double x, double y, double z, double t) {
        double r753743 = z;
        double r753744 = 3.0;
        double r753745 = r753743 * r753744;
        double r753746 = -6.2439806477432755e-55;
        bool r753747 = r753745 <= r753746;
        double r753748 = x;
        double r753749 = y;
        double r753750 = r753749 / r753743;
        double r753751 = r753750 / r753744;
        double r753752 = r753748 - r753751;
        double r753753 = t;
        double r753754 = r753745 * r753749;
        double r753755 = r753753 / r753754;
        double r753756 = r753752 + r753755;
        double r753757 = 2.1876294926720047e+119;
        bool r753758 = r753745 <= r753757;
        double r753759 = r753749 / r753745;
        double r753760 = r753748 - r753759;
        double r753761 = 1.0;
        double r753762 = r753761 / r753743;
        double r753763 = r753753 / r753744;
        double r753764 = r753763 / r753749;
        double r753765 = r753762 * r753764;
        double r753766 = r753760 + r753765;
        double r753767 = 0.3333333333333333;
        double r753768 = r753743 * r753749;
        double r753769 = r753753 / r753768;
        double r753770 = r753767 * r753769;
        double r753771 = r753760 + r753770;
        double r753772 = r753758 ? r753766 : r753771;
        double r753773 = r753747 ? r753756 : r753772;
        return r753773;
}

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.7
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 (* z 3.0) < -6.2439806477432755e-55

    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 associate-/r*0.5

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

    if -6.2439806477432755e-55 < (* z 3.0) < 2.1876294926720047e+119

    1. Initial program 8.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*2.5

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

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

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

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

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

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

    if 2.1876294926720047e+119 < (* z 3.0)

    1. Initial program 0.5

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot 3 \le -6.2439806477432755 \cdot 10^{-55}:\\ \;\;\;\;\left(x - \frac{\frac{y}{z}}{3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\\ \mathbf{elif}\;z \cdot 3 \le 2.1876294926720047 \cdot 10^{119}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{1}{z} \cdot \frac{\frac{t}{3}}{y}\\ \mathbf{else}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + 0.333333333333333315 \cdot \frac{t}{z \cdot y}\\ \end{array}\]

Reproduce

herbie shell --seed 2020020 +o rules:numerics
(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))))