?

Average Accuracy: 61.0% → 98.0%
Time: 18.6s
Precision: binary64
Cost: 13248

?

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

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original61.0%
Target75.0%
Herbie98.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 61.0%

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

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

    [Start]61.0

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

    *-lft-identity [<=]61.0

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

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

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

    *-lft-identity [=>]61.0

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

    *-commutative [<=]61.0

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

    *-rgt-identity [=>]61.0

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

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

Alternatives

Alternative 1
Accuracy87.6%
Cost13448
\[\begin{array}{l} t_1 := y \cdot \mathsf{expm1}\left(z\right)\\ \mathbf{if}\;y \leq -7.5 \cdot 10^{+64}:\\ \;\;\;\;x - \frac{1}{t \cdot 0.5 + \left(-0.5 \cdot \frac{t}{y} + \frac{t}{y \cdot z}\right)}\\ \mathbf{elif}\;y \leq -1.38 \cdot 10^{+17}:\\ \;\;\;\;\frac{-\mathsf{log1p}\left(t_1\right)}{t}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{1}{t \cdot 0.5 + \frac{t}{t_1}}\\ \end{array} \]
Alternative 2
Accuracy89.4%
Cost7232
\[x - \frac{1}{t \cdot 0.5 + \frac{t}{y \cdot \mathsf{expm1}\left(z\right)}} \]
Alternative 3
Accuracy90.6%
Cost7113
\[\begin{array}{l} \mathbf{if}\;y \leq -490 \lor \neg \left(y \leq 0.01\right):\\ \;\;\;\;x - \frac{1}{t \cdot 0.5 + \left(-0.5 \cdot \frac{t}{y} + \frac{t}{y \cdot z}\right)}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{\mathsf{expm1}\left(z\right)}{\frac{t}{y}}\\ \end{array} \]
Alternative 4
Accuracy88.0%
Cost6980
\[\begin{array}{l} \mathbf{if}\;y \leq -490:\\ \;\;\;\;x - \frac{1}{t \cdot 0.5 + \left(-0.5 \cdot \frac{t}{y} + \frac{t}{y \cdot z}\right)}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y \cdot \mathsf{expm1}\left(z\right)}{t}\\ \end{array} \]
Alternative 5
Accuracy84.9%
Cost1348
\[\begin{array}{l} \mathbf{if}\;y \leq -490:\\ \;\;\;\;x - \frac{1}{t \cdot 0.5 + \left(-0.5 \cdot \frac{t}{y} + \frac{t}{y \cdot z}\right)}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{1}{\frac{\frac{t}{z} + t \cdot -0.5}{y}}\\ \end{array} \]
Alternative 6
Accuracy81.3%
Cost832
\[x - \frac{1}{\frac{\frac{t}{z} + t \cdot -0.5}{y}} \]
Alternative 7
Accuracy69.9%
Cost648
\[\begin{array}{l} \mathbf{if}\;y \leq -3.6 \cdot 10^{+48}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -0.0004:\\ \;\;\;\;\frac{z}{t} \cdot \left(-y\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 8
Accuracy69.8%
Cost648
\[\begin{array}{l} \mathbf{if}\;y \leq -5 \cdot 10^{+48}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -0.0004:\\ \;\;\;\;\frac{-z}{\frac{t}{y}}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 9
Accuracy81.7%
Cost580
\[\begin{array}{l} \mathbf{if}\;z \leq -8 \cdot 10^{+70}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x - y \cdot \frac{z}{t}\\ \end{array} \]
Alternative 10
Accuracy81.8%
Cost580
\[\begin{array}{l} \mathbf{if}\;z \leq -8 \cdot 10^{+70}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y}{\frac{t}{z}}\\ \end{array} \]
Alternative 11
Accuracy71.6%
Cost64
\[x \]

Error

Reproduce?

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