(FPCore () :precision binary64 (let* ((t_0 (exp (- 100.0)))) (/ t_0 (+ t_0 (exp (- 101.0))))))
double code() { double t_0 = exp(-100.0); return t_0 / (t_0 + exp(-101.0)); }
real(8) function code() real(8) :: t_0 t_0 = exp(-100.0d0) code = t_0 / (t_0 + exp(-101.0d0)) end function
public static double code() { double t_0 = Math.exp(-100.0); return t_0 / (t_0 + Math.exp(-101.0)); }
def code(): t_0 = math.exp(-100.0) return t_0 / (t_0 + math.exp(-101.0))
function code() t_0 = exp(Float64(-100.0)) return Float64(t_0 / Float64(t_0 + exp(Float64(-101.0)))) end
function tmp = code() t_0 = exp(-100.0); tmp = t_0 / (t_0 + exp(-101.0)); end
code[] := Block[{t$95$0 = N[Exp[(-100.0)], $MachinePrecision]}, N[(t$95$0 / N[(t$95$0 + N[Exp[(-101.0)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l} \\ \begin{array}{l} t_0 := e^{-100}\\ \frac{t\_0}{t\_0 + e^{-101}} \end{array} \end{array}
Sampling outcomes in binary64 precision:
Herbie found 1 alternatives:
Alternative | Accuracy | Speedup |
---|
(FPCore () :precision binary64 (let* ((t_0 (exp (- 100.0)))) (/ t_0 (+ t_0 (exp (- 101.0))))))
double code() { double t_0 = exp(-100.0); return t_0 / (t_0 + exp(-101.0)); }
real(8) function code() real(8) :: t_0 t_0 = exp(-100.0d0) code = t_0 / (t_0 + exp(-101.0d0)) end function
public static double code() { double t_0 = Math.exp(-100.0); return t_0 / (t_0 + Math.exp(-101.0)); }
def code(): t_0 = math.exp(-100.0) return t_0 / (t_0 + math.exp(-101.0))
function code() t_0 = exp(Float64(-100.0)) return Float64(t_0 / Float64(t_0 + exp(Float64(-101.0)))) end
function tmp = code() t_0 = exp(-100.0); tmp = t_0 / (t_0 + exp(-101.0)); end
code[] := Block[{t$95$0 = N[Exp[(-100.0)], $MachinePrecision]}, N[(t$95$0 / N[(t$95$0 + N[Exp[(-101.0)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l} \\ \begin{array}{l} t_0 := e^{-100}\\ \frac{t\_0}{t\_0 + e^{-101}} \end{array} \end{array}
(FPCore () :precision binary64 (pow (* (exp 100.0) (+ (exp -101.0) (exp -100.0))) -1.0))
double code() { return pow((exp(100.0) * (exp(-101.0) + exp(-100.0))), -1.0); }
real(8) function code() code = (exp(100.0d0) * (exp((-101.0d0)) + exp((-100.0d0)))) ** (-1.0d0) end function
public static double code() { return Math.pow((Math.exp(100.0) * (Math.exp(-101.0) + Math.exp(-100.0))), -1.0); }
def code(): return math.pow((math.exp(100.0) * (math.exp(-101.0) + math.exp(-100.0))), -1.0)
function code() return Float64(exp(100.0) * Float64(exp(-101.0) + exp(-100.0))) ^ -1.0 end
function tmp = code() tmp = (exp(100.0) * (exp(-101.0) + exp(-100.0))) ^ -1.0; end
code[] := N[Power[N[(N[Exp[100.0], $MachinePrecision] * N[(N[Exp[-101.0], $MachinePrecision] + N[Exp[-100.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]
\begin{array}{l} \\ {\left(e^{100} \cdot \left(e^{-101} + e^{-100}\right)\right)}^{-1} \end{array}
Initial program 98.4%
lift-/.f64
N/A
clear-num
N/A
lower-/.f64
N/A
clear-num
N/A
associate-/r/
N/A
lower-*.f64
N/A
lift-exp.f64
N/A
rec-exp
N/A
lift-neg.f64
N/A
metadata-eval
N/A
metadata-eval
N/A
lower-exp.f64
100.0
lift-+.f64
N/A
+-commutative
N/A
lower-+.f64
100.0
lift-neg.f64
N/A
metadata-eval
100.0
lift-neg.f64
N/A
metadata-eval
100.0
Applied rewrites100.0%
Final simplification100.0%
herbie shell --seed 1
(FPCore ()
:name "exp(-100) / (exp(-100) + exp(-101))"
:precision binary64
(/ (exp (- 100.0)) (+ (exp (- 100.0)) (exp (- 101.0)))))