import math


def sigmoid(x):
    """Sigmoid function f(x)=1/(1+e^(-x))
    
    Args:
        x: float, input of sigmoid function
    Returns:
        y: float, function value
    """
    # for x which is to large, the sigmoid returns 1
    if x > 100:
        return 1.0

    # for x which is very small, the sigmoid returns 0
    if x < -100:
        return 1e-6
    
    return 1.0 / (1.0 + math.exp(-x))