Average Error: 24.8 → 8.0
Time: 7.6s
Precision: 64
\[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;e^{z} \le 0.999999999977131515:\\ \;\;\;\;x - \frac{2 \cdot \log \left(\sqrt[3]{\left(1 - y\right) + y \cdot e^{z}}\right) + \log \left(\sqrt[3]{\left(1 - y\right) + y \cdot e^{z}}\right)}{t}\\ \mathbf{else}:\\ \;\;\;\;x - \left(1 \cdot \left(\frac{z}{\sqrt[3]{t} \cdot \sqrt[3]{t}} \cdot \frac{y}{\sqrt[3]{t}}\right) + \frac{\log 1}{t}\right)\\ \end{array}\]
x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}
\begin{array}{l}
\mathbf{if}\;e^{z} \le 0.999999999977131515:\\
\;\;\;\;x - \frac{2 \cdot \log \left(\sqrt[3]{\left(1 - y\right) + y \cdot e^{z}}\right) + \log \left(\sqrt[3]{\left(1 - y\right) + y \cdot e^{z}}\right)}{t}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r403180 = x;
        double r403181 = 1.0;
        double r403182 = y;
        double r403183 = r403181 - r403182;
        double r403184 = z;
        double r403185 = exp(r403184);
        double r403186 = r403182 * r403185;
        double r403187 = r403183 + r403186;
        double r403188 = log(r403187);
        double r403189 = t;
        double r403190 = r403188 / r403189;
        double r403191 = r403180 - r403190;
        return r403191;
}

double f(double x, double y, double z, double t) {
        double r403192 = z;
        double r403193 = exp(r403192);
        double r403194 = 0.9999999999771315;
        bool r403195 = r403193 <= r403194;
        double r403196 = x;
        double r403197 = 2.0;
        double r403198 = 1.0;
        double r403199 = y;
        double r403200 = r403198 - r403199;
        double r403201 = r403199 * r403193;
        double r403202 = r403200 + r403201;
        double r403203 = cbrt(r403202);
        double r403204 = log(r403203);
        double r403205 = r403197 * r403204;
        double r403206 = r403205 + r403204;
        double r403207 = t;
        double r403208 = r403206 / r403207;
        double r403209 = r403196 - r403208;
        double r403210 = cbrt(r403207);
        double r403211 = r403210 * r403210;
        double r403212 = r403192 / r403211;
        double r403213 = r403199 / r403210;
        double r403214 = r403212 * r403213;
        double r403215 = r403198 * r403214;
        double r403216 = log(r403198);
        double r403217 = r403216 / r403207;
        double r403218 = r403215 + r403217;
        double r403219 = r403196 - r403218;
        double r403220 = r403195 ? r403209 : r403219;
        return r403220;
}

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

Original24.8
Target15.9
Herbie8.0
\[\begin{array}{l} \mathbf{if}\;z \lt -2.88746230882079466 \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 2 regimes
  2. if (exp z) < 0.9999999999771315

    1. Initial program 10.5

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

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

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

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

    if 0.9999999999771315 < (exp z)

    1. Initial program 31.2

      \[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\]
    2. Taylor expanded around 0 7.1

      \[\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}\]
    3. Simplified7.1

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

      \[\leadsto \color{blue}{x - \left(1 \cdot \frac{z \cdot y}{t} + \frac{\log 1}{t}\right)}\]
    5. Using strategy rm
    6. Applied add-cube-cbrt7.4

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;e^{z} \le 0.999999999977131515:\\ \;\;\;\;x - \frac{2 \cdot \log \left(\sqrt[3]{\left(1 - y\right) + y \cdot e^{z}}\right) + \log \left(\sqrt[3]{\left(1 - y\right) + y \cdot e^{z}}\right)}{t}\\ \mathbf{else}:\\ \;\;\;\;x - \left(1 \cdot \left(\frac{z}{\sqrt[3]{t} \cdot \sqrt[3]{t}} \cdot \frac{y}{\sqrt[3]{t}}\right) + \frac{\log 1}{t}\right)\\ \end{array}\]

Reproduce

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