import math


def deg2rad(dd):
    """
    Convert degrees to radian in the range -pi->pi

    :param dd: angle in degrees

    Nota: depending on the platform it could be 0<2pi
    A branch is cheaper than a trigo operation
    """
    while dd > 180.0:
        dd -= 360.0
    while dd < -180.0:
        dd += 360.0
    return dd * math.pi / 180.