def base40_to_interval_name(base40):
    """Base40 number to interval name conversion

    :param base40: Base40 interval number
    :type base40: int

    :returns: Interval name
    :rtype: str

    **Examples**

    >>> base40_to_interval_name(46)
    '+M9'
    """
    direction = '-' if base40 < 0 else '+'
    octave, interval = divmod(abs(base40), 40)
    names = [
        'P1', 'A1', None, None,
        'd2', 'm2', 'M2', 'A2', None, None,
        'd3', 'm3', 'M3', 'A3', None, None,
        'd4', 'P4', 'A4', None, None, None,
        'd5', 'P5', 'A5', None, None,
        'd6', 'm6', 'M6', 'A6', None, None,
        'd7', 'm7', 'M7', 'A7', None, None,
        'd8', 'P8',
    ]
    name = names[interval]
    if octave:
        name = name.replace(name[1], str(octave * 8 + int(name[1]) - 1))
    return ''.join([direction, name])