Average Error: 0.6 → 0.6
Time: 57.9s
Precision: 64
\[\frac{e^{a}}{e^{a} + e^{b}}\]
\[\frac{e^{a}}{e^{a} + e^{b}}\]

Error

Bits error versus a

Bits error versus b

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. Taylor expanded around -inf 0.6

    \[\leadsto \frac{e^{a}}{\color{blue}{e^{b} + e^{a}}}\]
  3. Final simplification0.6

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

Reproduce

herbie shell --seed 2019100 +o rules:numerics
(FPCore (a b)
  :name "Quotient of sum of exps"

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

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