Average Error: 25.1 → 8.6
Time: 12.5s
Precision: binary64
\[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;e^{z} \leq 0.9999999999973195:\\ \;\;\;\;x - \frac{\log \left(\left(1 - y\right) + \left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \left(e^{z} \cdot \sqrt[3]{y}\right)\right)}{t}\\ \mathbf{else}:\\ \;\;\;\;x - y \cdot \left(\left(z + \left(1 - y\right) \cdot \left(\left(z \cdot z\right) \cdot 0.5\right)\right) \cdot \frac{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} \leq 0.9999999999973195:\\
\;\;\;\;x - \frac{\log \left(\left(1 - y\right) + \left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \left(e^{z} \cdot \sqrt[3]{y}\right)\right)}{t}\\

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

\end{array}
(FPCore (x y z t)
 :precision binary64
 (- x (/ (log (+ (- 1.0 y) (* y (exp z)))) t)))
(FPCore (x y z t)
 :precision binary64
 (if (<= (exp z) 0.9999999999973195)
   (-
    x
    (/ (log (+ (- 1.0 y) (* (* (cbrt y) (cbrt y)) (* (exp z) (cbrt y))))) t))
   (- x (* y (* (+ z (* (- 1.0 y) (* (* z z) 0.5))) (/ 1.0 t))))))
double code(double x, double y, double z, double t) {
	return x - (log((1.0 - y) + (y * exp(z))) / t);
}
double code(double x, double y, double z, double t) {
	double tmp;
	if (exp(z) <= 0.9999999999973195) {
		tmp = x - (log((1.0 - y) + ((cbrt(y) * cbrt(y)) * (exp(z) * cbrt(y)))) / t);
	} else {
		tmp = x - (y * ((z + ((1.0 - y) * ((z * z) * 0.5))) * (1.0 / t)));
	}
	return tmp;
}

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.1
Target16.6
Herbie8.6
\[\begin{array}{l} \mathbf{if}\;z < -2.8874623088207947 \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.f64 z) < 1

    1. Initial program 11.6

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

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

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

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

    if 1 < (exp.f64 z)

    1. Initial program 31.3

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

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

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

      \[\leadsto x - \frac{\color{blue}{1 \cdot \left(y \cdot z + \left(0.5 \cdot \left(y \cdot \left(z \cdot z\right)\right)\right) \cdot \left(1 - y\right)\right)}}{t}\]
    6. Applied associate-/l*_binary64_38488.5

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

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

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

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

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

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

      \[\leadsto x - \color{blue}{y} \cdot \frac{1}{\frac{t}{z + \left(1 - y\right) \cdot \left(0.5 \cdot \left(z \cdot z\right)\right)}}\]
    14. Simplified7.2

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

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

Reproduce

herbie shell --seed 2020231 
(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.0 z) (* z z)))) (- x (/ (log (+ 1.0 (* z y))) t)))

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