Average Error: 24.8 → 8.9
Time: 8.3s
Precision: binary64
\[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;z \leq -1.5821215835774233 \cdot 10^{+26}:\\ \;\;\;\;x + \log \left(1 + \left(y \cdot e^{z} - y\right)\right) \cdot \frac{-1}{t}\\ \mathbf{elif}\;z \leq 5.038099887940745 \cdot 10^{-195}:\\ \;\;\;\;x - \left(1 \cdot \left(\frac{\sqrt[3]{z}}{\sqrt[3]{t}} \cdot \left(\frac{\sqrt[3]{z}}{\sqrt[3]{t}} \cdot \left(y \cdot \frac{\sqrt[3]{z}}{\sqrt[3]{t}}\right)\right)\right) + \left(\frac{\log 1}{t} + 0.5 \cdot \left(y \cdot \frac{z}{\frac{t}{z}}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x + \log \left(1 + y \cdot \left(0.16666666666666666 \cdot {z}^{3} + \left(z + z \cdot \left(z \cdot 0.5\right)\right)\right)\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}\;z \leq -1.5821215835774233 \cdot 10^{+26}:\\
\;\;\;\;x + \log \left(1 + \left(y \cdot e^{z} - y\right)\right) \cdot \frac{-1}{t}\\

\mathbf{elif}\;z \leq 5.038099887940745 \cdot 10^{-195}:\\
\;\;\;\;x - \left(1 \cdot \left(\frac{\sqrt[3]{z}}{\sqrt[3]{t}} \cdot \left(\frac{\sqrt[3]{z}}{\sqrt[3]{t}} \cdot \left(y \cdot \frac{\sqrt[3]{z}}{\sqrt[3]{t}}\right)\right)\right) + \left(\frac{\log 1}{t} + 0.5 \cdot \left(y \cdot \frac{z}{\frac{t}{z}}\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;x + \log \left(1 + y \cdot \left(0.16666666666666666 \cdot {z}^{3} + \left(z + z \cdot \left(z \cdot 0.5\right)\right)\right)\right) \cdot \frac{-1}{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 (<= z -1.5821215835774233e+26)
   (+ x (* (log (+ 1.0 (- (* y (exp z)) y))) (/ -1.0 t)))
   (if (<= z 5.038099887940745e-195)
     (-
      x
      (+
       (*
        1.0
        (*
         (/ (cbrt z) (cbrt t))
         (* (/ (cbrt z) (cbrt t)) (* y (/ (cbrt z) (cbrt t))))))
       (+ (/ (log 1.0) t) (* 0.5 (* y (/ z (/ t z)))))))
     (+
      x
      (*
       (log
        (+
         1.0
         (* y (+ (* 0.16666666666666666 (pow z 3.0)) (+ z (* z (* z 0.5)))))))
       (/ -1.0 t))))))
double code(double x, double y, double z, double t) {
	return ((double) (x - (((double) log(((double) (((double) (1.0 - y)) + ((double) (y * ((double) exp(z)))))))) / t)));
}
double code(double x, double y, double z, double t) {
	double tmp;
	if ((z <= -1.5821215835774233e+26)) {
		tmp = ((double) (x + ((double) (((double) log(((double) (1.0 + ((double) (((double) (y * ((double) exp(z)))) - y)))))) * (-1.0 / t)))));
	} else {
		double tmp_1;
		if ((z <= 5.038099887940745e-195)) {
			tmp_1 = ((double) (x - ((double) (((double) (1.0 * ((double) ((((double) cbrt(z)) / ((double) cbrt(t))) * ((double) ((((double) cbrt(z)) / ((double) cbrt(t))) * ((double) (y * (((double) cbrt(z)) / ((double) cbrt(t))))))))))) + ((double) ((((double) log(1.0)) / t) + ((double) (0.5 * ((double) (y * (z / (t / z))))))))))));
		} else {
			tmp_1 = ((double) (x + ((double) (((double) log(((double) (1.0 + ((double) (y * ((double) (((double) (0.16666666666666666 * ((double) pow(z, 3.0)))) + ((double) (z + ((double) (z * ((double) (z * 0.5)))))))))))))) * (-1.0 / t)))));
		}
		tmp = tmp_1;
	}
	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

Original24.8
Target16.0
Herbie8.9
\[\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 3 regimes
  2. if z < -1.5821215835774233e26

    1. Initial program Error: 12.0 bits

      \[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\]
    2. SimplifiedError: 12.0 bits

      \[\leadsto \color{blue}{x - \frac{\log \left(1 + \left(y \cdot e^{z} - y\right)\right)}{t}}\]
    3. Using strategy rm
    4. Applied div-invError: 12.0 bits

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

    if -1.5821215835774233e26 < z < 5.0380998879407453e-195

    1. Initial program Error: 29.8 bits

      \[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\]
    2. SimplifiedError: 14.8 bits

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

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

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

      \[\leadsto x - \left(1 \cdot \left(y \cdot \frac{z}{\color{blue}{\left(\sqrt[3]{t} \cdot \sqrt[3]{t}\right) \cdot \sqrt[3]{t}}}\right) + \left(\frac{\log 1}{t} + 0.5 \cdot \left(y \cdot \frac{z}{\frac{t}{z}}\right)\right)\right)\]
    7. Applied add-cube-cbrtError: 6.7 bits

      \[\leadsto x - \left(1 \cdot \left(y \cdot \frac{\color{blue}{\left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right) \cdot \sqrt[3]{z}}}{\left(\sqrt[3]{t} \cdot \sqrt[3]{t}\right) \cdot \sqrt[3]{t}}\right) + \left(\frac{\log 1}{t} + 0.5 \cdot \left(y \cdot \frac{z}{\frac{t}{z}}\right)\right)\right)\]
    8. Applied times-fracError: 6.7 bits

      \[\leadsto x - \left(1 \cdot \left(y \cdot \color{blue}{\left(\frac{\sqrt[3]{z} \cdot \sqrt[3]{z}}{\sqrt[3]{t} \cdot \sqrt[3]{t}} \cdot \frac{\sqrt[3]{z}}{\sqrt[3]{t}}\right)}\right) + \left(\frac{\log 1}{t} + 0.5 \cdot \left(y \cdot \frac{z}{\frac{t}{z}}\right)\right)\right)\]
    9. Applied associate-*r*Error: 6.3 bits

      \[\leadsto x - \left(1 \cdot \color{blue}{\left(\left(y \cdot \frac{\sqrt[3]{z} \cdot \sqrt[3]{z}}{\sqrt[3]{t} \cdot \sqrt[3]{t}}\right) \cdot \frac{\sqrt[3]{z}}{\sqrt[3]{t}}\right)} + \left(\frac{\log 1}{t} + 0.5 \cdot \left(y \cdot \frac{z}{\frac{t}{z}}\right)\right)\right)\]
    10. SimplifiedError: 6.3 bits

      \[\leadsto x - \left(1 \cdot \left(\color{blue}{\left(y \cdot \left(\frac{\sqrt[3]{z}}{\sqrt[3]{t}} \cdot \frac{\sqrt[3]{z}}{\sqrt[3]{t}}\right)\right)} \cdot \frac{\sqrt[3]{z}}{\sqrt[3]{t}}\right) + \left(\frac{\log 1}{t} + 0.5 \cdot \left(y \cdot \frac{z}{\frac{t}{z}}\right)\right)\right)\]
    11. Using strategy rm
    12. Applied associate-*r*Error: 6.3 bits

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

    if 5.0380998879407453e-195 < z

    1. Initial program Error: 29.2 bits

      \[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\]
    2. SimplifiedError: 17.5 bits

      \[\leadsto \color{blue}{x - \frac{\log \left(1 + \left(y \cdot e^{z} - y\right)\right)}{t}}\]
    3. Using strategy rm
    4. Applied div-invError: 17.5 bits

      \[\leadsto x - \color{blue}{\log \left(1 + \left(y \cdot e^{z} - y\right)\right) \cdot \frac{1}{t}}\]
    5. Taylor expanded around 0 Error: 11.0 bits

      \[\leadsto x - \log \left(1 + \color{blue}{\left(0.16666666666666666 \cdot \left({z}^{3} \cdot y\right) + \left(z \cdot y + 0.5 \cdot \left({z}^{2} \cdot y\right)\right)\right)}\right) \cdot \frac{1}{t}\]
    6. SimplifiedError: 11.0 bits

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

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

Reproduce

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