I have a large number of type float (3.7625745528893614e-83) which must go through the sigmoid function:
def sigmoid_one(x):#sigmoid computation function
return (1/(1+math.e**(-x)))
,but after passing a large number (that is, a number with many characters after the decimal point) through the function, 0.5 is always obtained. For a solution, I wanted to try the round() function:
round(3.7625745528893614e-83,10)
, but after calculations it gives zero. Does anyone know a solution to this problem? maybe there is a replacement for the round () function or an alternative solution?
For small
x
, the functionexp(-x)
is about the same as1-x
, so your function is approximately equal to1/(2-x)
which, for smallx
is about1/2
. So your program is working correctly.