Re: [Rd] Undefined behavior of head() and tail() with n = 0

2017-01-27 Thread Martin Maechler
Dear Florent, thank you for striving to clearly disentangle and present the issue below. That is a nice "role model" way of approaching such topics! > Florent Angly > on Fri, 27 Jan 2017 10:24:39 +0100 writes: > Martin, I agree with you that +0 and -0 should generally be treated

Re: [Rd] Undefined behavior of head() and tail() with n = 0

2017-01-27 Thread Florent Angly
Martin, I agree with you that +0 and -0 should generally be treated as equal, and R does a fine job in this respect. The Wikipedia article on signed zero (https://en.wikipedia.org/wiki/Signed_zero) echoes this view but also highlights that +0 and -0 can be treated differently in particular situatio

Re: [Rd] Undefined behavior of head() and tail() with n = 0

2017-01-26 Thread William Dunlap via R-devel
In addition, signed zeroes only exist for floating point numbers - the bit patterns for as.integer(0) and as.integer(-0) are identical. Bill Dunlap TIBCO Software wdunlap tibco.com On Thu, Jan 26, 2017 at 1:53 AM, Martin Maechler wrote: >> Florent Angly >> on Wed, 25 Jan 2017 16:31:

Re: [Rd] Undefined behavior of head() and tail() with n = 0

2017-01-26 Thread Martin Maechler
> Florent Angly > on Wed, 25 Jan 2017 16:31:45 +0100 writes: > Hi all, > The documentation for head() and tail() describes the behavior of > these generic functions when n is strictly positive (n > 0) and > strictly negative (n < 0). How these functions work when given

[Rd] Undefined behavior of head() and tail() with n = 0

2017-01-25 Thread Florent Angly
Hi all, The documentation for head() and tail() describes the behavior of these generic functions when n is strictly positive (n > 0) and strictly negative (n < 0). How these functions work when given a zero value is not defined. Both GNU command-line utilities head and tail behave differently wi