?

Average Error: 0.3 → 1.2
Time: 33.1s
Precision: binary64
Cost: 7108

?

\[e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \]
\[\begin{array}{l} \mathbf{if}\;w \leq 0.0115:\\ \;\;\;\;\ell \cdot \left(1 + \left(\log \ell - 1\right) \cdot w\right)\\ \mathbf{else}:\\ \;\;\;\;-1 + \left(1 - \frac{\ell}{-e^{w}}\right)\\ \end{array} \]
(FPCore (w l) :precision binary64 (* (exp (- w)) (pow l (exp w))))
(FPCore (w l)
 :precision binary64
 (if (<= w 0.0115)
   (* l (+ 1.0 (* (- (log l) 1.0) w)))
   (+ -1.0 (- 1.0 (/ l (- (exp w)))))))
double code(double w, double l) {
	return exp(-w) * pow(l, exp(w));
}
double code(double w, double l) {
	double tmp;
	if (w <= 0.0115) {
		tmp = l * (1.0 + ((log(l) - 1.0) * w));
	} else {
		tmp = -1.0 + (1.0 - (l / -exp(w)));
	}
	return tmp;
}
real(8) function code(w, l)
    real(8), intent (in) :: w
    real(8), intent (in) :: l
    code = exp(-w) * (l ** exp(w))
end function
real(8) function code(w, l)
    real(8), intent (in) :: w
    real(8), intent (in) :: l
    real(8) :: tmp
    if (w <= 0.0115d0) then
        tmp = l * (1.0d0 + ((log(l) - 1.0d0) * w))
    else
        tmp = (-1.0d0) + (1.0d0 - (l / -exp(w)))
    end if
    code = tmp
end function
public static double code(double w, double l) {
	return Math.exp(-w) * Math.pow(l, Math.exp(w));
}
public static double code(double w, double l) {
	double tmp;
	if (w <= 0.0115) {
		tmp = l * (1.0 + ((Math.log(l) - 1.0) * w));
	} else {
		tmp = -1.0 + (1.0 - (l / -Math.exp(w)));
	}
	return tmp;
}
def code(w, l):
	return math.exp(-w) * math.pow(l, math.exp(w))
def code(w, l):
	tmp = 0
	if w <= 0.0115:
		tmp = l * (1.0 + ((math.log(l) - 1.0) * w))
	else:
		tmp = -1.0 + (1.0 - (l / -math.exp(w)))
	return tmp
function code(w, l)
	return Float64(exp(Float64(-w)) * (l ^ exp(w)))
end
function code(w, l)
	tmp = 0.0
	if (w <= 0.0115)
		tmp = Float64(l * Float64(1.0 + Float64(Float64(log(l) - 1.0) * w)));
	else
		tmp = Float64(-1.0 + Float64(1.0 - Float64(l / Float64(-exp(w)))));
	end
	return tmp
end
function tmp = code(w, l)
	tmp = exp(-w) * (l ^ exp(w));
end
function tmp_2 = code(w, l)
	tmp = 0.0;
	if (w <= 0.0115)
		tmp = l * (1.0 + ((log(l) - 1.0) * w));
	else
		tmp = -1.0 + (1.0 - (l / -exp(w)));
	end
	tmp_2 = tmp;
end
code[w_, l_] := N[(N[Exp[(-w)], $MachinePrecision] * N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
code[w_, l_] := If[LessEqual[w, 0.0115], N[(l * N[(1.0 + N[(N[(N[Log[l], $MachinePrecision] - 1.0), $MachinePrecision] * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.0 + N[(1.0 - N[(l / (-N[Exp[w], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
e^{-w} \cdot {\ell}^{\left(e^{w}\right)}
\begin{array}{l}
\mathbf{if}\;w \leq 0.0115:\\
\;\;\;\;\ell \cdot \left(1 + \left(\log \ell - 1\right) \cdot w\right)\\

\mathbf{else}:\\
\;\;\;\;-1 + \left(1 - \frac{\ell}{-e^{w}}\right)\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Split input into 2 regimes
  2. if w < 0.0115

    1. Initial program 0.3

      \[e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \]
    2. Taylor expanded in w around 0 1.3

      \[\leadsto e^{-w} \cdot \color{blue}{\left(\ell + \ell \cdot \left(w \cdot \log \ell\right)\right)} \]
    3. Simplified1.3

      \[\leadsto e^{-w} \cdot \color{blue}{\left(\ell + \ell \cdot \left(\log \ell \cdot w\right)\right)} \]
      Proof

      [Start]1.3

      \[ e^{-w} \cdot \left(\ell + \ell \cdot \left(w \cdot \log \ell\right)\right) \]

      rational.json-simplify-2 [=>]1.3

      \[ e^{-w} \cdot \left(\ell + \ell \cdot \color{blue}{\left(\log \ell \cdot w\right)}\right) \]
    4. Taylor expanded in l around 0 1.3

      \[\leadsto \color{blue}{e^{-w} \cdot \left(\ell \cdot \left(1 + w \cdot \log \ell\right)\right)} \]
    5. Simplified1.3

      \[\leadsto \color{blue}{\ell \cdot \frac{1 + \log \left({\ell}^{w}\right)}{e^{w}}} \]
      Proof

      [Start]1.3

      \[ e^{-w} \cdot \left(\ell \cdot \left(1 + w \cdot \log \ell\right)\right) \]

      rational.json-simplify-43 [=>]1.3

      \[ \color{blue}{\ell \cdot \left(\left(1 + w \cdot \log \ell\right) \cdot e^{-w}\right)} \]

      rational.json-simplify-1 [=>]1.3

      \[ \ell \cdot \left(\color{blue}{\left(w \cdot \log \ell + 1\right)} \cdot e^{-w}\right) \]

      rational.json-simplify-2 [=>]1.3

      \[ \ell \cdot \left(\left(\color{blue}{\log \ell \cdot w} + 1\right) \cdot e^{-w}\right) \]

      rational.json-simplify-43 [=>]1.3

      \[ \color{blue}{\left(\log \ell \cdot w + 1\right) \cdot \left(e^{-w} \cdot \ell\right)} \]

      rational.json-simplify-2 [=>]1.3

      \[ \color{blue}{\left(e^{-w} \cdot \ell\right) \cdot \left(\log \ell \cdot w + 1\right)} \]

      exponential.json-simplify-2 [=>]1.3

      \[ \left(\color{blue}{\frac{1}{e^{w}}} \cdot \ell\right) \cdot \left(\log \ell \cdot w + 1\right) \]

      rational.json-simplify-7 [<=]1.3

      \[ \left(\frac{1}{e^{w}} \cdot \color{blue}{\frac{\ell}{1}}\right) \cdot \left(\log \ell \cdot w + 1\right) \]

      rational.json-simplify-55 [=>]1.3

      \[ \color{blue}{\frac{\frac{\ell}{1}}{\frac{e^{w}}{1}}} \cdot \left(\log \ell \cdot w + 1\right) \]

      rational.json-simplify-7 [=>]1.3

      \[ \frac{\color{blue}{\ell}}{\frac{e^{w}}{1}} \cdot \left(\log \ell \cdot w + 1\right) \]

      rational.json-simplify-7 [=>]1.3

      \[ \frac{\ell}{\color{blue}{e^{w}}} \cdot \left(\log \ell \cdot w + 1\right) \]

      rational.json-simplify-1 [=>]1.3

      \[ \frac{\ell}{e^{w}} \cdot \color{blue}{\left(1 + \log \ell \cdot w\right)} \]

      rational.json-simplify-17 [=>]1.3

      \[ \frac{\ell}{e^{w}} \cdot \color{blue}{\left(\log \ell \cdot w - -1\right)} \]

      metadata-eval [<=]1.3

      \[ \frac{\ell}{e^{w}} \cdot \left(\log \ell \cdot w - \color{blue}{\left(-1 - 0\right)}\right) \]

      rational.json-simplify-45 [<=]1.3

      \[ \frac{\ell}{e^{w}} \cdot \color{blue}{\left(0 - \left(-1 - \log \ell \cdot w\right)\right)} \]

      rational.json-simplify-12 [<=]1.3

      \[ \frac{\ell}{e^{w}} \cdot \color{blue}{\left(-\left(-1 - \log \ell \cdot w\right)\right)} \]

      rational.json-simplify-10 [=>]1.3

      \[ \frac{\ell}{e^{w}} \cdot \color{blue}{\frac{-1 - \log \ell \cdot w}{-1}} \]

      rational.json-simplify-49 [<=]1.3

      \[ \color{blue}{\frac{\left(-1 - \log \ell \cdot w\right) \cdot \frac{\ell}{e^{w}}}{-1}} \]

      rational.json-simplify-49 [<=]1.3

      \[ \frac{\color{blue}{\frac{\ell \cdot \left(-1 - \log \ell \cdot w\right)}{e^{w}}}}{-1} \]

      rational.json-simplify-47 [=>]1.3

      \[ \color{blue}{\frac{\ell \cdot \left(-1 - \log \ell \cdot w\right)}{e^{w} \cdot -1}} \]
    6. Taylor expanded in w around 0 1.3

      \[\leadsto \ell \cdot \color{blue}{\left(1 + \left(\log \ell - 1\right) \cdot w\right)} \]

    if 0.0115 < w

    1. Initial program 0.1

      \[e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \]
    2. Taylor expanded in w around 0 1.4

      \[\leadsto e^{-w} \cdot \color{blue}{\ell} \]
    3. Applied egg-rr0.9

      \[\leadsto \color{blue}{-1 + \left(1 - \frac{\ell}{-e^{w}}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification1.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;w \leq 0.0115:\\ \;\;\;\;\ell \cdot \left(1 + \left(\log \ell - 1\right) \cdot w\right)\\ \mathbf{else}:\\ \;\;\;\;-1 + \left(1 - \frac{\ell}{-e^{w}}\right)\\ \end{array} \]

Alternatives

Alternative 1
Error0.3
Cost19520
\[e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \]
Alternative 2
Error0.3
Cost19456
\[\frac{{\ell}^{\left(e^{w}\right)}}{e^{w}} \]
Alternative 3
Error1.4
Cost13440
\[e^{-w} \cdot \left(\ell + \ell \cdot \left(\log \ell \cdot w\right)\right) \]
Alternative 4
Error1.9
Cost6656
\[e^{-w} \cdot \ell \]
Alternative 5
Error1.9
Cost6592
\[\frac{\ell}{e^{w}} \]
Alternative 6
Error2.6
Cost516
\[\begin{array}{l} \mathbf{if}\;w \leq 1.85 \cdot 10^{-14}:\\ \;\;\;\;\ell + \ell \cdot \left(-w\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\ell + -2\right) - -2\\ \end{array} \]
Alternative 7
Error2.6
Cost452
\[\begin{array}{l} \mathbf{if}\;w \leq 1.85 \cdot 10^{-14}:\\ \;\;\;\;\ell \cdot \left(1 - w\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\ell + -2\right) - -2\\ \end{array} \]
Alternative 8
Error13.7
Cost64
\[\ell \]

Error

Reproduce?

herbie shell --seed 2023075 
(FPCore (w l)
  :name "exp-w (used to crash)"
  :precision binary64
  (* (exp (- w)) (pow l (exp w))))