-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviormathsMathematical functionsMathematical functions
Milestone
Description
Demo:
julia> start = 0.10000000000000045
0.10000000000000045
julia> linspace(start, 1)[1] - start
-1.3877787807814457e-17
julia> linspace(start, 1).start - start
0.0I think the error here is in unsafe_getindex(::LinSpace, ::Integer), which assumes b*a/b == a, which unfortunately isn't true. The above amounts to computing
julia> 0.10000000000000045 * 49.0 / 49.0 - 0.10000000000000045
-1.3877787807814457e-17Probably needless to say, this is a big problem for numerical code which should be able to assume LinSpace will exactly preserve the start and end values.
Metadata
Metadata
Assignees
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviormathsMathematical functionsMathematical functions