@@ -333,6 +333,27 @@ for T = (Float32, Float64,),# BigFloat),
333
333
@test [r[n: - 2 : 1 ];] == [r;][n: - 2 : 1 ]
334
334
end
335
335
336
+ # issue #20373 (unliftable ranges with exact end points)
337
+ @test [3 * 0.05 : 0.05 : 0.2 ;] == [linspace (3 * 0.05 ,0.2 ,2 );] == [3 * 0.05 ,0.2 ]
338
+ @test [0.2 : - 0.05 : 3 * 0.05 ;] == [linspace (0.2 ,3 * 0.05 ,2 );] == [0.2 ,3 * 0.05 ]
339
+ @test [- 3 * 0.05 : - 0.05 : - 0.2 ;] == [linspace (- 3 * 0.05 ,- 0.2 ,2 );] == [- 3 * 0.05 ,- 0.2 ]
340
+ @test [- 0.2 : 0.05 : - 3 * 0.05 ;] == [linspace (- 0.2 ,- 3 * 0.05 ,2 );] == [- 0.2 ,- 3 * 0.05 ]
341
+
342
+ for T = (Float32, Float64,), i = 1 : 2 ^ 15 , n = 1 : 5
343
+ start, step = randn (T), randn (T)
344
+ stop = start + (n- 1 )* step
345
+ r = start: step: stop
346
+ @test n == length (r)
347
+ # FIXME : these fail some small portion of the time
348
+ @test_skip start == first (r)
349
+ @test_skip stop == last (r)
350
+ l = linspace (start,stop,n)
351
+ @test n == length (l)
352
+ # FIXME : these fail some small portion of the time
353
+ @test_skip start == first (l)
354
+ @test_skip stop == last (l)
355
+ end
356
+
336
357
# linspace & ranges with very small endpoints
337
358
for T = (Float32, Float64)
338
359
z = zero (T)
0 commit comments