Re: Positive random number
- From: Richard Heathfield <rjh@xxxxxxxxxxxxxxx>
- Date: Wed, 19 Dec 2007 18:41:44 +0000
santosh said:
Johannes Bauer wrote:
<snip discussion about whether zero should be considered
positive or not>
The status of zero in mathematics seems to be similar to that of the
photon in physics. The "correct" definition in a particular case is the
definition that yields good results!
The important thing is not what mathematicians think about 0, but what C
programmers think about 0. And it can be shown from the Standard that 0 is
neither positive nor negative.
See, for example, 3.3.5 (Multiplicative operators - and I'm quoting from
C89 here), which says (of division / and modulo %) that "if the value of
the second operand is zero, the behavior is undefined", before going on to
define the behaviour for positive and negative operands. If zero is either
positive or negative, a contradiction arises. Therefore, it cannot be
either.
--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
.
- Follow-Ups:
- Re: Positive random number
- From: Johannes Bauer
- Re: Positive random number
- References:
- Positive random number
- From: deepak
- Re: Positive random number
- From: Jack Klein
- Re: Positive random number
- From: Keith Thompson
- Re: Positive random number
- From: Johannes Bauer
- Re: Positive random number
- From: pete
- Re: Positive random number
- From: Spoon
- Re: Positive random number
- From: Richard Heathfield
- Re: Positive random number
- From: Johannes Bauer
- Re: Positive random number
- From: James Kuyper
- Re: Positive random number
- From: Johannes Bauer
- Re: Positive random number
- From: Philip Potter
- Re: Positive random number
- From: Johannes Bauer
- Re: Positive random number
- From: santosh
- Positive random number
- Prev by Date: Re: main
- Next by Date: Re: Signed Unsigned problem
- Previous by thread: Re: Positive random number
- Next by thread: Re: Positive random number
- Index(es):
Relevant Pages
|