Average Error: 25.0 → 11.0
Time: 8.4s
Precision: binary64
\[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \leq -\infty:\\ \;\;\;\;x - \frac{\log \left(1 + y \cdot \left(z + 0.5 \cdot \left(z \cdot z\right)\right)\right)}{t}\\ \mathbf{elif}\;x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \leq -1.2237850520638158 \cdot 10^{+31}:\\ \;\;\;\;x - \frac{1}{\frac{t}{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}}\\ \mathbf{elif}\;x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \leq -9.808485353193813 \cdot 10^{-254}:\\ \;\;\;\;x - \frac{1}{\frac{t}{y \cdot z} + 0.5 \cdot \left(t - \frac{t}{y}\right)}\\ \mathbf{elif}\;x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \leq -2.3925554644476883 \cdot 10^{-263}:\\ \;\;\;\;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{elif}\;x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \leq 4.726731912050994 \cdot 10^{-98}:\\ \;\;\;\;x - \frac{1}{\frac{\frac{t}{y}}{z + \left(1 - y\right) \cdot \left(0.5 \cdot \left(z \cdot z\right)\right)}}\\ \mathbf{elif}\;x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \leq 5.616777882652408 \cdot 10^{+306}:\\ \;\;\;\;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 - \frac{\log \left(1 + y \cdot \left(z + 0.5 \cdot \left(z \cdot z\right)\right)\right)}{t}\\ \end{array}\]
x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}
\begin{array}{l}
\mathbf{if}\;x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \leq -\infty:\\
\;\;\;\;x - \frac{\log \left(1 + y \cdot \left(z + 0.5 \cdot \left(z \cdot z\right)\right)\right)}{t}\\

\mathbf{elif}\;x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \leq -1.2237850520638158 \cdot 10^{+31}:\\
\;\;\;\;x - \frac{1}{\frac{t}{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}}\\

\mathbf{elif}\;x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \leq -9.808485353193813 \cdot 10^{-254}:\\
\;\;\;\;x - \frac{1}{\frac{t}{y \cdot z} + 0.5 \cdot \left(t - \frac{t}{y}\right)}\\

\mathbf{elif}\;x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \leq -2.3925554644476883 \cdot 10^{-263}:\\
\;\;\;\;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{elif}\;x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \leq 4.726731912050994 \cdot 10^{-98}:\\
\;\;\;\;x - \frac{1}{\frac{\frac{t}{y}}{z + \left(1 - y\right) \cdot \left(0.5 \cdot \left(z \cdot z\right)\right)}}\\

\mathbf{elif}\;x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \leq 5.616777882652408 \cdot 10^{+306}:\\
\;\;\;\;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 - \frac{\log \left(1 + y \cdot \left(z + 0.5 \cdot \left(z \cdot z\right)\right)\right)}{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 (<= (- x (/ (log (+ (- 1.0 y) (* y (exp z)))) t)) (- INFINITY))
   (- x (/ (log (+ 1.0 (* y (+ z (* 0.5 (* z z)))))) t))
   (if (<=
        (- x (/ (log (+ (- 1.0 y) (* y (exp z)))) t))
        -1.2237850520638158e+31)
     (- x (/ 1.0 (/ t (log (+ (- 1.0 y) (* y (exp z)))))))
     (if (<=
          (- x (/ (log (+ (- 1.0 y) (* y (exp z)))) t))
          -9.808485353193813e-254)
       (- x (/ 1.0 (+ (/ t (* y z)) (* 0.5 (- t (/ t y))))))
       (if (<=
            (- x (/ (log (+ (- 1.0 y) (* y (exp z)))) t))
            -2.3925554644476883e-263)
         (-
          x
          (/
           (log (+ (- 1.0 y) (* (* (cbrt y) (cbrt y)) (* (exp z) (cbrt y)))))
           t))
         (if (<=
              (- x (/ (log (+ (- 1.0 y) (* y (exp z)))) t))
              4.726731912050994e-98)
           (- x (/ 1.0 (/ (/ t y) (+ z (* (- 1.0 y) (* 0.5 (* z z)))))))
           (if (<=
                (- x (/ (log (+ (- 1.0 y) (* y (exp z)))) t))
                5.616777882652408e+306)
             (-
              x
              (/
               (log
                (+ (- 1.0 y) (* (* (cbrt y) (cbrt y)) (* (exp z) (cbrt y)))))
               t))
             (- x (/ (log (+ 1.0 (* y (+ z (* 0.5 (* z 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 ((x - (log((1.0 - y) + (y * exp(z))) / t)) <= -((double) INFINITY)) {
		tmp = x - (log(1.0 + (y * (z + (0.5 * (z * z))))) / t);
	} else if ((x - (log((1.0 - y) + (y * exp(z))) / t)) <= -1.2237850520638158e+31) {
		tmp = x - (1.0 / (t / log((1.0 - y) + (y * exp(z)))));
	} else if ((x - (log((1.0 - y) + (y * exp(z))) / t)) <= -9.808485353193813e-254) {
		tmp = x - (1.0 / ((t / (y * z)) + (0.5 * (t - (t / y)))));
	} else if ((x - (log((1.0 - y) + (y * exp(z))) / t)) <= -2.3925554644476883e-263) {
		tmp = x - (log((1.0 - y) + ((cbrt(y) * cbrt(y)) * (exp(z) * cbrt(y)))) / t);
	} else if ((x - (log((1.0 - y) + (y * exp(z))) / t)) <= 4.726731912050994e-98) {
		tmp = x - (1.0 / ((t / y) / (z + ((1.0 - y) * (0.5 * (z * z))))));
	} else if ((x - (log((1.0 - y) + (y * exp(z))) / t)) <= 5.616777882652408e+306) {
		tmp = x - (log((1.0 - y) + ((cbrt(y) * cbrt(y)) * (exp(z) * cbrt(y)))) / t);
	} else {
		tmp = x - (log(1.0 + (y * (z + (0.5 * (z * 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
Target16.4
Herbie11.0
\[\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 5 regimes
  2. if (-.f64 x (/.f64 (log.f64 (+.f64 (-.f64 1 y) (*.f64 y (exp.f64 z)))) t)) < -inf.0 or 5.6167778826524082e306 < (-.f64 x (/.f64 (log.f64 (+.f64 (-.f64 1 y) (*.f64 y (exp.f64 z)))) t))

    1. Initial program 63.9

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

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

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

    if -inf.0 < (-.f64 x (/.f64 (log.f64 (+.f64 (-.f64 1 y) (*.f64 y (exp.f64 z)))) t)) < -1.2237850520638158e31

    1. Initial program 2.5

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

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

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

    if -1.2237850520638158e31 < (-.f64 x (/.f64 (log.f64 (+.f64 (-.f64 1 y) (*.f64 y (exp.f64 z)))) t)) < -9.80848535319381343e-254

    1. Initial program 15.8

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

      \[\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. Simplified23.4

      \[\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 clear-num_binary64_962523.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)}}}\]
    6. Simplified23.5

      \[\leadsto x - \frac{1}{\color{blue}{\frac{t}{y \cdot \left(z + \left(1 - y\right) \cdot \left(\left(z \cdot z\right) \cdot 0.5\right)\right)}}}\]
    7. Taylor expanded around 0 15.6

      \[\leadsto x - \frac{1}{\color{blue}{\left(0.5 \cdot t + \frac{t}{z \cdot y}\right) - 0.5 \cdot \frac{t}{y}}}\]
    8. Simplified15.6

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

    if -9.80848535319381343e-254 < (-.f64 x (/.f64 (log.f64 (+.f64 (-.f64 1 y) (*.f64 y (exp.f64 z)))) t)) < -2.3925554644476883e-263 or 4.72673191205099409e-98 < (-.f64 x (/.f64 (log.f64 (+.f64 (-.f64 1 y) (*.f64 y (exp.f64 z)))) t)) < 5.6167778826524082e306

    1. Initial program 5.7

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

      \[\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_95675.9

      \[\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. Simplified5.9

      \[\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 -2.3925554644476883e-263 < (-.f64 x (/.f64 (log.f64 (+.f64 (-.f64 1 y) (*.f64 y (exp.f64 z)))) t)) < 4.72673191205099409e-98

    1. Initial program 26.0

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

      \[\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. Simplified25.6

      \[\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 clear-num_binary64_962525.6

      \[\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)}}}\]
    6. Simplified25.6

      \[\leadsto x - \frac{1}{\color{blue}{\frac{t}{y \cdot \left(z + \left(1 - y\right) \cdot \left(\left(z \cdot z\right) \cdot 0.5\right)\right)}}}\]
    7. Using strategy rm
    8. Applied associate-/r*_binary64_957020.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \leq -\infty:\\ \;\;\;\;x - \frac{\log \left(1 + y \cdot \left(z + 0.5 \cdot \left(z \cdot z\right)\right)\right)}{t}\\ \mathbf{elif}\;x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \leq -1.2237850520638158 \cdot 10^{+31}:\\ \;\;\;\;x - \frac{1}{\frac{t}{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}}\\ \mathbf{elif}\;x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \leq -9.808485353193813 \cdot 10^{-254}:\\ \;\;\;\;x - \frac{1}{\frac{t}{y \cdot z} + 0.5 \cdot \left(t - \frac{t}{y}\right)}\\ \mathbf{elif}\;x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \leq -2.3925554644476883 \cdot 10^{-263}:\\ \;\;\;\;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{elif}\;x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \leq 4.726731912050994 \cdot 10^{-98}:\\ \;\;\;\;x - \frac{1}{\frac{\frac{t}{y}}{z + \left(1 - y\right) \cdot \left(0.5 \cdot \left(z \cdot z\right)\right)}}\\ \mathbf{elif}\;x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \leq 5.616777882652408 \cdot 10^{+306}:\\ \;\;\;\;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 - \frac{\log \left(1 + y \cdot \left(z + 0.5 \cdot \left(z \cdot z\right)\right)\right)}{t}\\ \end{array}\]

Reproduce

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