import typing
import math


def lists_are_equal(a: typing.List[float], b: typing.List[float]) -> bool:
    """Return True if all members of the two lists are equal. NaNs are treated as equal."""
    if len(a) != len(b):
        return False
    for v_a, v_b in zip(a, b):
        if math.isnan(v_a) or math.isnan(v_b):
            # Both NaN or both  non-NaN
            if math.isnan(v_a) ^ math.isnan(v_b):
                return False
        else:
            if v_a != v_b:
                return False
    return True