Average Error: 25.0 → 8.2
Time: 13.6s
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:\\ \;\;\;\;x - \frac{\log \left(1 + \left(e^{z} \cdot y - \sqrt[3]{y} \cdot \left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right)\right)\right)}{t}\\ \mathbf{else}:\\ \;\;\;\;x - y \cdot \frac{z}{t}\\ \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:\\
\;\;\;\;x - \frac{\log \left(1 + \left(e^{z} \cdot y - \sqrt[3]{y} \cdot \left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right)\right)\right)}{t}\\

\mathbf{else}:\\
\;\;\;\;x - y \cdot \frac{z}{t}\\

\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.0)
   (-
    x
    (/ (log (+ 1.0 (- (* (exp z) y) (* (cbrt y) (* (cbrt y) (cbrt y)))))) t))
   (- x (* y (/ z 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.0) {
		tmp = x - (log(1.0 + ((exp(z) * y) - (cbrt(y) * (cbrt(y) * cbrt(y))))) / t);
	} else {
		tmp = x - (y * (z / 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.0
Target15.9
Herbie8.2
\[\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) < 0.0

    1. Initial program 12.0

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

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

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

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

    if 0.0 < (exp.f64 z)

    1. Initial program 30.6

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

      \[\leadsto x - \color{blue}{\frac{z \cdot y}{t}}\]
    3. Simplified9.5

      \[\leadsto x - \color{blue}{\frac{y}{t} \cdot z}\]
    4. Using strategy rm
    5. Applied div-inv_binary64_103059.6

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

      \[\leadsto x - \color{blue}{y \cdot \left(\frac{1}{t} \cdot z\right)}\]
    7. Simplified6.6

      \[\leadsto x - y \cdot \color{blue}{\frac{z}{t}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification8.2

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

Reproduce

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