|for (n in 4:0) print(seq(1, by=1/(n-1), length.out=n)) # [1] 1.000000 1.333333 1.666667 2.000000 # [1] 1.0 1.5 2.0 # [1] 1 2 # [1] NaN <- this should be 1 # integer(0) for (n in 4:0) print(seq.int(1, by=1/(n-1), length.out=n)) # [1] 1.000000 1.333333 1.666667 2.000000 # [1] 1.0 1.5 2.0 # [1] 1 2 # Error in seq.int(1, by = 1/(n - 1), length.out = n) : <- this should be 1, not an error # 'by' must be a finite number # integer(0) <- (result for n=0) |
I believe changing this would prevent quite some edge case bugs, for example this one:
|> colorspace::divergingx_hcl(1) Error in seq.int(1, by = -2/(n - 1), length.out = n2) : 'by' must be a finite number |
Do see any downside to this? -Jan
OpenPGP_signature.asc
Description: OpenPGP digital signature
______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel