Math FPCore C Fortran Java Python Julia MATLAB Wolfram TeX \[\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}}
Alternatives Alternative 1 Error 1.0 Cost 26184
\[\begin{array}{l}
t_0 := \frac{1}{1 + e^{b}}\\
\mathbf{if}\;e^{b} \leq 0.998:\\
\;\;\;\;t_0\\
\mathbf{elif}\;e^{b} \leq 1:\\
\;\;\;\;\frac{e^{a}}{1 + e^{a}}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
Alternative 2 Error 1.3 Cost 13252
\[\begin{array}{l}
\mathbf{if}\;e^{a} \leq 0.995:\\
\;\;\;\;\frac{e^{a}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{1 + e^{b}}\\
\end{array}
\]
Alternative 3 Error 14.6 Cost 6920
\[\begin{array}{l}
t_0 := \frac{1}{b + 2}\\
\mathbf{if}\;b \leq 1.65 \cdot 10^{+15}:\\
\;\;\;\;\frac{e^{a}}{2}\\
\mathbf{elif}\;b \leq 3.7 \cdot 10^{+88}:\\
\;\;\;\;-0.020833333333333332 \cdot {a}^{3}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(t_0 \cdot \frac{1}{0.5 + -0.25 \cdot b}\right)\\
\end{array}
\]
Alternative 4 Error 14.8 Cost 6724
\[\begin{array}{l}
t_0 := \frac{1}{b + 2}\\
\mathbf{if}\;b \leq 1.55 \cdot 10^{+105}:\\
\;\;\;\;\frac{e^{a}}{2}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(t_0 \cdot \frac{1}{0.5 + -0.25 \cdot b}\right)\\
\end{array}
\]
Alternative 5 Error 28.0 Cost 1348
\[\begin{array}{l}
t_0 := \frac{1}{b + 2}\\
\mathbf{if}\;b \leq 10^{-193}:\\
\;\;\;\;0.5 + a \cdot 0.25\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(t_0 \cdot \frac{1}{0.5 + -0.25 \cdot b}\right)\\
\end{array}
\]
Alternative 6 Error 31.1 Cost 964
\[\begin{array}{l}
t_0 := \frac{1}{b + 2}\\
\mathbf{if}\;b \leq 1.25 \cdot 10^{-193}:\\
\;\;\;\;0.5 + a \cdot 0.25\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(t_0 \cdot 2\right)\\
\end{array}
\]
Alternative 7 Error 39.4 Cost 320
\[0.5 + a \cdot 0.25
\]
Alternative 8 Error 39.5 Cost 64
\[0.5
\]