develooper Front page | perl.perl5.porters | Postings from August 2010

RE: [perl #76756] PATCH: srand returns the seed

Thread Previous | Thread Next
Jan Dubois
August 2, 2010 11:12
RE: [perl #76756] PATCH: srand returns the seed
Message ID:
On Mon, 02 Aug 2010, Nicholas Clark wrote:
> What I can't work out is whether there is any shortcut way in ANSI C to find
> out whether a value is -0, distinct from 0, short of *printf().

In ASNI C99 you can use copysign(), but that is not required in C89.  It has been
an IEEE 754 recommended function, so it is present in many older libraries.

The only other way I can think of is computing 1/x and checking if you get
-Inf or Inf, but that may be a costly operation, given that it will throw
a floating point exception.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About