def remap_interval(val, min1, max1, min2, max2):
    """ Remap a value from one range to a new range.

    - val: the value to remap
    - min1: the minimum for the old range `val` is within
    - max1: the maximum for the old range `val` is within
    - min2: the minimum for the new range
    - max2: the maximum for the new range
    
    # The doctests in this functiona originally were nearly sufficient, as they tested
      several numbers at different intervals.
    : I added an additional unit test to check that the remap function works with negative numbers,
      as it would need to remap values from -1 to 1, to 0 to 255.
    >>> remap_interval(0.5, 0, 1, 0, 10)
    5.0
    >>> remap_interval(5, 4, 6, 0, 2)
    1.0
    >>> remap_interval(5, 4, 6, 1, 2)
    1.5
    >>> remap_interval(0, -1, 1, 0, 255)
    127.5
    """
    # Take the value and remove the previous minimum, then multiply by the difference
    # raitio, and then add the new minimum 
    return (((max2 - min2) / (max1 - min1)) * (val - min1)) + min2