Average Error: 25.3 → 10.8
Time: 23.2s
Precision: 64
\[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \le -1.440743594728946531171226609163262891102 \cdot 10^{292}:\\ \;\;\;\;x - \frac{\log \left(1 + y \cdot \left(\frac{1}{2} \cdot {z}^{2} + z\right)\right)}{t}\\ \mathbf{elif}\;\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \le -3.611603069415811887919454562832725120938 \cdot 10^{-266}:\\ \;\;\;\;x - \frac{\log \left(\left(1 - y\right) + \left(\sqrt[3]{y \cdot e^{z}} \cdot \sqrt[3]{y \cdot e^{z}}\right) \cdot \sqrt[3]{y \cdot e^{z}}\right)}{t}\\ \mathbf{elif}\;\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \le -0.0:\\ \;\;\;\;x - \left(1 \cdot \left(z \cdot \frac{y}{t}\right) + \frac{\log 1}{t}\right)\\ \mathbf{elif}\;\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \le 1.256324954617756675438518762743726617656 \cdot 10^{220}:\\ \;\;\;\;x - \frac{\log \left(\left(1 - y\right) + \left(\sqrt[3]{y \cdot e^{z}} \cdot \sqrt[3]{y \cdot e^{z}}\right) \cdot \sqrt[3]{y \cdot e^{z}}\right)}{t}\\ \mathbf{else}:\\ \;\;\;\;x - \left(y \cdot \left(0.5 \cdot {z}^{2} + 1 \cdot z\right) + \log 1\right) \cdot \frac{1}{t}\\ \end{array}\]
x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}
\begin{array}{l}
\mathbf{if}\;\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \le -1.440743594728946531171226609163262891102 \cdot 10^{292}:\\
\;\;\;\;x - \frac{\log \left(1 + y \cdot \left(\frac{1}{2} \cdot {z}^{2} + z\right)\right)}{t}\\

\mathbf{elif}\;\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \le -3.611603069415811887919454562832725120938 \cdot 10^{-266}:\\
\;\;\;\;x - \frac{\log \left(\left(1 - y\right) + \left(\sqrt[3]{y \cdot e^{z}} \cdot \sqrt[3]{y \cdot e^{z}}\right) \cdot \sqrt[3]{y \cdot e^{z}}\right)}{t}\\

\mathbf{elif}\;\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \le -0.0:\\
\;\;\;\;x - \left(1 \cdot \left(z \cdot \frac{y}{t}\right) + \frac{\log 1}{t}\right)\\

\mathbf{elif}\;\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \le 1.256324954617756675438518762743726617656 \cdot 10^{220}:\\
\;\;\;\;x - \frac{\log \left(\left(1 - y\right) + \left(\sqrt[3]{y \cdot e^{z}} \cdot \sqrt[3]{y \cdot e^{z}}\right) \cdot \sqrt[3]{y \cdot e^{z}}\right)}{t}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r189119 = x;
        double r189120 = 1.0;
        double r189121 = y;
        double r189122 = r189120 - r189121;
        double r189123 = z;
        double r189124 = exp(r189123);
        double r189125 = r189121 * r189124;
        double r189126 = r189122 + r189125;
        double r189127 = log(r189126);
        double r189128 = t;
        double r189129 = r189127 / r189128;
        double r189130 = r189119 - r189129;
        return r189130;
}

double f(double x, double y, double z, double t) {
        double r189131 = 1.0;
        double r189132 = y;
        double r189133 = r189131 - r189132;
        double r189134 = z;
        double r189135 = exp(r189134);
        double r189136 = r189132 * r189135;
        double r189137 = r189133 + r189136;
        double r189138 = log(r189137);
        double r189139 = t;
        double r189140 = r189138 / r189139;
        double r189141 = -1.4407435947289465e+292;
        bool r189142 = r189140 <= r189141;
        double r189143 = x;
        double r189144 = 0.5;
        double r189145 = 2.0;
        double r189146 = pow(r189134, r189145);
        double r189147 = r189144 * r189146;
        double r189148 = r189147 + r189134;
        double r189149 = r189132 * r189148;
        double r189150 = r189131 + r189149;
        double r189151 = log(r189150);
        double r189152 = r189151 / r189139;
        double r189153 = r189143 - r189152;
        double r189154 = -3.611603069415812e-266;
        bool r189155 = r189140 <= r189154;
        double r189156 = cbrt(r189136);
        double r189157 = r189156 * r189156;
        double r189158 = r189157 * r189156;
        double r189159 = r189133 + r189158;
        double r189160 = log(r189159);
        double r189161 = r189160 / r189139;
        double r189162 = r189143 - r189161;
        double r189163 = -0.0;
        bool r189164 = r189140 <= r189163;
        double r189165 = r189132 / r189139;
        double r189166 = r189134 * r189165;
        double r189167 = r189131 * r189166;
        double r189168 = log(r189131);
        double r189169 = r189168 / r189139;
        double r189170 = r189167 + r189169;
        double r189171 = r189143 - r189170;
        double r189172 = 1.2563249546177567e+220;
        bool r189173 = r189140 <= r189172;
        double r189174 = 0.5;
        double r189175 = r189174 * r189146;
        double r189176 = r189131 * r189134;
        double r189177 = r189175 + r189176;
        double r189178 = r189132 * r189177;
        double r189179 = r189178 + r189168;
        double r189180 = 1.0;
        double r189181 = r189180 / r189139;
        double r189182 = r189179 * r189181;
        double r189183 = r189143 - r189182;
        double r189184 = r189173 ? r189162 : r189183;
        double r189185 = r189164 ? r189171 : r189184;
        double r189186 = r189155 ? r189162 : r189185;
        double r189187 = r189142 ? r189153 : r189186;
        return r189187;
}

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

Original25.3
Target16.5
Herbie10.8
\[\begin{array}{l} \mathbf{if}\;z \lt -2.887462308820794658905265984545350618896 \cdot 10^{119}:\\ \;\;\;\;\left(x - \frac{\frac{-0.5}{y \cdot t}}{z \cdot z}\right) - \frac{-0.5}{y \cdot t} \cdot \frac{\frac{2}{z}}{z \cdot z}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{\log \left(1 + z \cdot y\right)}{t}\\ \end{array}\]

Derivation

  1. Split input into 4 regimes
  2. if (/ (log (+ (- 1.0 y) (* y (exp z)))) t) < -1.4407435947289465e+292

    1. Initial program 63.5

      \[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt48.9

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

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

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

    if -1.4407435947289465e+292 < (/ (log (+ (- 1.0 y) (* y (exp z)))) t) < -3.611603069415812e-266 or -0.0 < (/ (log (+ (- 1.0 y) (* y (exp z)))) t) < 1.2563249546177567e+220

    1. Initial program 9.4

      \[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt9.8

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

    if -3.611603069415812e-266 < (/ (log (+ (- 1.0 y) (* y (exp z)))) t) < -0.0

    1. Initial program 12.4

      \[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt12.8

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

      \[\leadsto x - \frac{\color{blue}{0.5 \cdot \left({z}^{2} \cdot y\right) + \left(1 \cdot \left(z \cdot y\right) + \log 1\right)}}{t}\]
    5. Simplified16.4

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

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

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

      \[\leadsto x - \left(1 \cdot \color{blue}{\left(\frac{z}{1} \cdot \frac{y}{t}\right)} + \frac{\log 1}{t}\right)\]
    10. Simplified9.5

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

    if 1.2563249546177567e+220 < (/ (log (+ (- 1.0 y) (* y (exp z)))) t)

    1. Initial program 60.5

      \[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt47.8

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

      \[\leadsto x - \frac{\color{blue}{0.5 \cdot \left({z}^{2} \cdot y\right) + \left(1 \cdot \left(z \cdot y\right) + \log 1\right)}}{t}\]
    5. Simplified18.0

      \[\leadsto x - \frac{\color{blue}{y \cdot \left(0.5 \cdot {z}^{2} + 1 \cdot z\right) + \log 1}}{t}\]
    6. Using strategy rm
    7. Applied div-inv18.0

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \le -1.440743594728946531171226609163262891102 \cdot 10^{292}:\\ \;\;\;\;x - \frac{\log \left(1 + y \cdot \left(\frac{1}{2} \cdot {z}^{2} + z\right)\right)}{t}\\ \mathbf{elif}\;\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \le -3.611603069415811887919454562832725120938 \cdot 10^{-266}:\\ \;\;\;\;x - \frac{\log \left(\left(1 - y\right) + \left(\sqrt[3]{y \cdot e^{z}} \cdot \sqrt[3]{y \cdot e^{z}}\right) \cdot \sqrt[3]{y \cdot e^{z}}\right)}{t}\\ \mathbf{elif}\;\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \le -0.0:\\ \;\;\;\;x - \left(1 \cdot \left(z \cdot \frac{y}{t}\right) + \frac{\log 1}{t}\right)\\ \mathbf{elif}\;\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \le 1.256324954617756675438518762743726617656 \cdot 10^{220}:\\ \;\;\;\;x - \frac{\log \left(\left(1 - y\right) + \left(\sqrt[3]{y \cdot e^{z}} \cdot \sqrt[3]{y \cdot e^{z}}\right) \cdot \sqrt[3]{y \cdot e^{z}}\right)}{t}\\ \mathbf{else}:\\ \;\;\;\;x - \left(y \cdot \left(0.5 \cdot {z}^{2} + 1 \cdot z\right) + \log 1\right) \cdot \frac{1}{t}\\ \end{array}\]

Reproduce

herbie shell --seed 2019326 
(FPCore (x y z t)
  :name "System.Random.MWC.Distributions:truncatedExp from mwc-random-0.13.3.2"
  :precision binary64

  :herbie-target
  (if (< z -2.8874623088207947e+119) (- (- x (/ (/ (- 0.5) (* y t)) (* z z))) (* (/ (- 0.5) (* y t)) (/ (/ 2 z) (* z z)))) (- x (/ (log (+ 1 (* z y))) t)))

  (- x (/ (log (+ (- 1 y) (* y (exp z)))) t)))