-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
linspace behavior with integer arguments #2575
Comments
You want |
Check the version of Julia you are using. For me it is
Also, I think you wanted
|
Title changed to reflect actual issue. Adding decision tag. |
I deliberately gave integer output for integer input. But perhaps nobody ever actually wants that? |
The idea with linspace (linear space) is that it does linear interpolation between the two first arguments, which produce a line: "Construct a vector of n linearly-spaced elements from start to stop." The current behavior gives you a step function instead of a line. I guess I would like the linear behavior 99% of the time, and could deal with the 1% with a round(). |
That seems reasonable. |
As long as the arguments aren't automatically converted to floating point, because the following behavior shouldn't change: julia> linspace(0//1,1//1,5)
5-element Rational{Int64} Array:
0//1
1//4
1//2
3//4
1//1 |
x = linspace(0,1,10)
Gives me:
0000011111
Which is not very linear.
The text was updated successfully, but these errors were encountered: