I’ve noticed that when I create a linspace object, if I do so using integers as my min-and-max values, the created object is a float64 object. If I do this using floats for my min-and-max, the created object is a float32 dtype.
As this seems inconsistent to me I was wondering if there was a reason for the different datatype constructions?
I have pasted minimal code for a demo and the output of the script below.
Hi @Zak_Williams, If you see the source code of the linspace particularly at this code line
upon calculating the delta value the start and end datatype is being cast to delta datatype. so when passing start and end as an integer the delta dtype is float64 as the denominator is an integer.
If you pass float values to start and end the delta dtype is float32 as the denominator is an float32, because the initially passing float values is considered as float32 dtype.
But if you convert float32 to float64 and then pass that float64 to start and end values the delta dtype is float64 as the denominator is an float64. For example,