def METHOD_NAME(x, posinf=1e10, neginf=-1e10, nan=0.0):
    """Part of the Numba implementation of np.nan_to_num - see nan_to_num"""
    for i in range(len(x)):
        if np.isnan(x[i]):
            x[i] = nan
        if np.isinf(x[i]):
            if x[i] > 0:
                x[i] = posinf
            else:
                x[i] = neginf
    return x