?

Average Error: 0.6 → 0.6
Time: 7.7s
Precision: binary64
Cost: 19520

?

\[\frac{e^{a}}{e^{a} + e^{b}} \]
\[\frac{e^{a}}{e^{a} + e^{b}} \]
(FPCore (a b) :precision binary64 (/ (exp a) (+ (exp a) (exp b))))
(FPCore (a b) :precision binary64 (/ (exp a) (+ (exp a) (exp b))))
double code(double a, double b) {
	return exp(a) / (exp(a) + exp(b));
}
double code(double a, double b) {
	return exp(a) / (exp(a) + exp(b));
}
real(8) function code(a, b)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = exp(a) / (exp(a) + exp(b))
end function
real(8) function code(a, b)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = exp(a) / (exp(a) + exp(b))
end function
public static double code(double a, double b) {
	return Math.exp(a) / (Math.exp(a) + Math.exp(b));
}
public static double code(double a, double b) {
	return Math.exp(a) / (Math.exp(a) + Math.exp(b));
}
def code(a, b):
	return math.exp(a) / (math.exp(a) + math.exp(b))
def code(a, b):
	return math.exp(a) / (math.exp(a) + math.exp(b))
function code(a, b)
	return Float64(exp(a) / Float64(exp(a) + exp(b)))
end
function code(a, b)
	return Float64(exp(a) / Float64(exp(a) + exp(b)))
end
function tmp = code(a, b)
	tmp = exp(a) / (exp(a) + exp(b));
end
function tmp = code(a, b)
	tmp = exp(a) / (exp(a) + exp(b));
end
code[a_, b_] := N[(N[Exp[a], $MachinePrecision] / N[(N[Exp[a], $MachinePrecision] + N[Exp[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[a_, b_] := N[(N[Exp[a], $MachinePrecision] / N[(N[Exp[a], $MachinePrecision] + N[Exp[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{e^{a}}{e^{a} + e^{b}}
\frac{e^{a}}{e^{a} + e^{b}}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.6
Target0.0
Herbie0.6
\[\frac{1}{1 + e^{b - a}} \]

Derivation?

  1. Initial program 0.6

    \[\frac{e^{a}}{e^{a} + e^{b}} \]
  2. Final simplification0.6

    \[\leadsto \frac{e^{a}}{e^{a} + e^{b}} \]

Alternatives

Alternative 1
Error0.7
Cost19913
\[\begin{array}{l} \mathbf{if}\;e^{b} \leq 0 \lor \neg \left(e^{b} \leq 1\right):\\ \;\;\;\;\frac{1}{e^{b} + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{-1 + \frac{-1}{e^{a}}}\\ \end{array} \]
Alternative 2
Error0.7
Cost19849
\[\begin{array}{l} \mathbf{if}\;e^{b} \leq 0 \lor \neg \left(e^{b} \leq 1\right):\\ \;\;\;\;\frac{1}{e^{b} + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{1 + e^{-a}}\\ \end{array} \]
Alternative 3
Error1.0
Cost13252
\[\begin{array}{l} \mathbf{if}\;e^{a} \leq 0:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{e^{b} + 1}\\ \end{array} \]
Alternative 4
Error2.1
Cost6856
\[\begin{array}{l} \mathbf{if}\;b \leq -1.1:\\ \;\;\;\;e^{a}\\ \mathbf{elif}\;b \leq 350:\\ \;\;\;\;\frac{e^{a}}{2}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
Alternative 5
Error0.0
Cost6848
\[\frac{-1}{-1 - e^{b - a}} \]
Alternative 6
Error7.2
Cost6596
\[\begin{array}{l} \mathbf{if}\;b \leq -2.7 \cdot 10^{-6}:\\ \;\;\;\;e^{a}\\ \mathbf{elif}\;b \leq 5.9 \cdot 10^{-5}:\\ \;\;\;\;\frac{-1}{\left(a + -0.5 \cdot \left(a \cdot a\right)\right) + -2}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
Alternative 7
Error13.3
Cost708
\[\begin{array}{l} \mathbf{if}\;a \leq -100:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;1 + \left(-1 + \frac{1}{b + 2}\right)\\ \end{array} \]
Alternative 8
Error22.0
Cost452
\[\begin{array}{l} \mathbf{if}\;a \leq -0.000205:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;0.5 + a \cdot 0.25\\ \end{array} \]
Alternative 9
Error22.2
Cost196
\[\begin{array}{l} \mathbf{if}\;a \leq -8.5 \cdot 10^{-5}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;0.5\\ \end{array} \]
Alternative 10
Error39.1
Cost64
\[0.5 \]

Error

Reproduce?

herbie shell --seed 2023059 
(FPCore (a b)
  :name "Quotient of sum of exps"
  :precision binary64

  :herbie-target
  (/ 1.0 (+ 1.0 (exp (- b a))))

  (/ (exp a) (+ (exp a) (exp b))))