import math


def sigmoid(x: float) -> float:
    """Implements 1 / (1 + e^(-x))"""
    try:
        return 1 / (1 + math.pow(math.e, -1 * x))
    except OverflowError:
        # If the number is too small, we get an overflow, and thus return 0
        return 0