?

Average Error: 24.8 → 1.0
Time: 19.0s
Precision: binary64
Cost: 13376

?

\[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \]
\[x + \frac{-1}{\frac{t}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}} \]
(FPCore (x y z t)
 :precision binary64
 (- x (/ (log (+ (- 1.0 y) (* y (exp z)))) t)))
(FPCore (x y z t)
 :precision binary64
 (+ x (/ -1.0 (/ t (log1p (* y (expm1 z)))))))
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) {
	return x + (-1.0 / (t / log1p((y * expm1(z)))));
}
public static double code(double x, double y, double z, double t) {
	return x - (Math.log(((1.0 - y) + (y * Math.exp(z)))) / t);
}
public static double code(double x, double y, double z, double t) {
	return x + (-1.0 / (t / Math.log1p((y * Math.expm1(z)))));
}
def code(x, y, z, t):
	return x - (math.log(((1.0 - y) + (y * math.exp(z)))) / t)
def code(x, y, z, t):
	return x + (-1.0 / (t / math.log1p((y * math.expm1(z)))))
function code(x, y, z, t)
	return Float64(x - Float64(log(Float64(Float64(1.0 - y) + Float64(y * exp(z)))) / t))
end
function code(x, y, z, t)
	return Float64(x + Float64(-1.0 / Float64(t / log1p(Float64(y * expm1(z))))))
end
code[x_, y_, z_, t_] := N[(x - N[(N[Log[N[(N[(1.0 - y), $MachinePrecision] + N[(y * N[Exp[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_] := N[(x + N[(-1.0 / N[(t / N[Log[1 + N[(y * N[(Exp[z] - 1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}
x + \frac{-1}{\frac{t}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original24.8
Target16.2
Herbie1.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. Initial program 24.8

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

    \[\leadsto \color{blue}{x - \frac{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}{t}} \]
    Proof

    [Start]24.8

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

    *-lft-identity [<=]24.8

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

    distribute-lft-out-- [<=]24.8

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

    *-lft-identity [=>]24.8

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

    *-commutative [<=]24.8

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

    *-rgt-identity [=>]24.8

    \[ x - \color{blue}{\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}} \]
  3. Applied egg-rr1.0

    \[\leadsto x - \color{blue}{{\left(\frac{t}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}\right)}^{-1}} \]
  4. Applied egg-rr1.0

    \[\leadsto x - \color{blue}{\frac{1}{\frac{t}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}}} \]
  5. Final simplification1.0

    \[\leadsto x + \frac{-1}{\frac{t}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}} \]

Alternatives

Alternative 1
Error1.0
Cost13248
\[x - \frac{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}{t} \]
Alternative 2
Error4.5
Cost7364
\[\begin{array}{l} \mathbf{if}\;z \leq -9.5 \cdot 10^{+21}:\\ \;\;\;\;x + \frac{-1}{\frac{t}{y \cdot \mathsf{expm1}\left(z\right)} + t \cdot 0.5}\\ \mathbf{else}:\\ \;\;\;\;x + \mathsf{log1p}\left(y \cdot z\right) \cdot \frac{-1}{t}\\ \end{array} \]
Alternative 3
Error6.3
Cost7113
\[\begin{array}{l} \mathbf{if}\;y \leq -5.1 \cdot 10^{+42} \lor \neg \left(y \leq 1.25 \cdot 10^{+43}\right):\\ \;\;\;\;x + \frac{-1}{t \cdot 0.5 + \frac{t}{y \cdot z}}\\ \mathbf{else}:\\ \;\;\;\;x - \mathsf{expm1}\left(z\right) \cdot \frac{y}{t}\\ \end{array} \]
Alternative 4
Error6.4
Cost7108
\[\begin{array}{l} \mathbf{if}\;z \leq -1.15 \cdot 10^{+53}:\\ \;\;\;\;x - \mathsf{expm1}\left(z\right) \cdot \frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \mathsf{log1p}\left(y \cdot z\right) \cdot \frac{-1}{t}\\ \end{array} \]
Alternative 5
Error7.1
Cost6980
\[\begin{array}{l} \mathbf{if}\;y \leq -7.4 \cdot 10^{+61}:\\ \;\;\;\;x + \frac{-1}{t \cdot 0.5 + \frac{t}{y \cdot z}}\\ \mathbf{else}:\\ \;\;\;\;x - y \cdot \frac{\mathsf{expm1}\left(z\right)}{t}\\ \end{array} \]
Alternative 6
Error6.3
Cost6980
\[\begin{array}{l} \mathbf{if}\;z \leq -7.2 \cdot 10^{+52}:\\ \;\;\;\;x - \mathsf{expm1}\left(z\right) \cdot \frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{\mathsf{log1p}\left(y \cdot z\right)}{t}\\ \end{array} \]
Alternative 7
Error10.7
Cost964
\[\begin{array}{l} \mathbf{if}\;z \leq -7 \cdot 10^{+52}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x + \frac{-1}{t \cdot 0.5 + \frac{t}{y \cdot z}}\\ \end{array} \]
Alternative 8
Error12.4
Cost708
\[\begin{array}{l} \mathbf{if}\;z \leq -1.3 \cdot 10^{-16}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x + \left(y \cdot z\right) \cdot \frac{-1}{t}\\ \end{array} \]
Alternative 9
Error18.2
Cost648
\[\begin{array}{l} \mathbf{if}\;t \leq -6 \cdot 10^{-200}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq -1.28 \cdot 10^{-287}:\\ \;\;\;\;\frac{-y}{\frac{t}{z}}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 10
Error11.9
Cost580
\[\begin{array}{l} \mathbf{if}\;z \leq -3.1 \cdot 10^{-24}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x - y \cdot \frac{z}{t}\\ \end{array} \]
Alternative 11
Error12.4
Cost580
\[\begin{array}{l} \mathbf{if}\;z \leq -1.3 \cdot 10^{-16}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y \cdot z}{t}\\ \end{array} \]
Alternative 12
Error17.9
Cost64
\[x \]

Error

Reproduce?

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