Average Error: 0.7 → 0.7
Time: 2.7s
Precision: 64
\[\frac{e^{a}}{e^{a} + e^{b}}\]
\[\frac{e^{a}}{e^{a} + e^{b}}\]
\frac{e^{a}}{e^{a} + e^{b}}
\frac{e^{a}}{e^{a} + e^{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)));
}

Error

Bits error versus a

Bits error versus b

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 0.7

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

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

Reproduce

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

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

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