[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#7877: sleep 5 -4

From: Paul Eggert
Subject: bug#7877: sleep 5 -4
Date: Tue, 25 Jan 2011 01:27:49 -0800
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20101208 Thunderbird/3.1.7

OK, so it's late, but I can't resist:

First, 'sleep' does accept one number that's negative
in an IEEE-754 sense, namely, "sleep -- -0.0".

Second, due to rounding error, 'sleep' does accept some
numbers that are negative in a mathematical sense, e.g.,
"sleep -- -1e1000" works.

Third, there's nothing intrinsically wrong with 'sleep'
accepting negative numbers.  All that POSIX
requires is that 'sleep' must sleep for at *least* the
amount of time specified.  So, if "sleep -- -1.0"
is treated like "sleep 0", then it's conforming to
that requirement of POSIX (obviously it doesn't
conform to the other requirement that the operand be
a nonnegative decimal integer; but it's a valid extension
that is consistent with POSIX).

(Have I written enough to tempt you to extend 'sleep'
to allow negative numbers?  :-)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]