Slightly generalize and improve the accuracy of arange and linspace