Re: Memory Leak Problem



e p chandler wrote:
(snip of many good suggestions)

5. seed=aint(harvest*2.0e0**31) Why not the simpler 2**31?

Because 2**31 will overflow on many machines.

2.**31 should not overflow, and should be done using a
fairly efficient set of squaring and multiplication
by 2.0.

(snip of more good suggestions)

-- glen

.



Relevant Pages

  • Re: Why is that interger overflow silently result in rotation of the value
    ... >> provided relatively economically even on hardware that traps on overflow.) ... >Any trap is likely to be very expensive, ... >> with integer overflow. ...
    (comp.lang.c.moderated)
  • Re: Ariane
    ... >> Dan Nagle wrote in message ... ... >> Overflow interception, once established, ... >Because the code worked on the Ariane 4. ...
    (comp.lang.fortran)
  • Re: User Input issue
    ... The hard part will be "detect overflow" portably without causing ... <snip lengthy post of C code accessible as ... and have to worry about (sizeof long == sizeof int). ... Posted via a free Usenet account from http://www.teranews.com ...
    (comp.lang.c)
  • Re: User Input issue
    ... it seems like a pretty interesting exercice for the OP. ... The hard part will be "detect overflow" portably without causing ... <snip lengthy post of C code accessible as ... EOF (it fails "correctly", but it is not elegant), redundant tests and code ...
    (comp.lang.c)
  • Re: Eventual undefined behaviour
    ... expressions whose results would ... would be less than INT_MIN yield INT_MIN. ... values into overflow signals, with no correction available. ... snip ... ...
    (comp.lang.c)