For Programmers: Free Programming Magazines  


Home > Archive > Fortran > June 2007 > Re: Form k = i + j and test for overflow.









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Form k = i + j and test for overflow.
Arjen Markus

2007-06-19, 7:09 pm

On 19 jun, 14:30, glen herrmannsfeldt <g...@ugcs.caltech.edu> wrote:
> Arjen Markus wrote:
>
> (snip)
>
>
> (snip)
>
>
> How do you check for overflow of the longest integer supplied?
>
> The OP seems to be worried about how fast things are, and
> always wants to be as fast as possible. That means using
> the longest possible integer type.
>
> -- glen


Hm, I assumed that 4-byte integers would be large enough for
most purposes. Then using 8-byte integers (or whatever larger integer
type is available) would provide an elegant solution
(one of the other possibilities ;))

Regards,

Arjen

glen herrmannsfeldt

2007-06-19, 7:09 pm

Arjen Markus wrote:

(snip)

> Hm, I assumed that 4-byte integers would be large enough for
> most purposes. Then using 8-byte integers (or whatever larger integer
> type is available) would provide an elegant solution
> (one of the other possibilities ;))


These days 32 bits (or 31) is often not enough for a random
number generator. There are many that are much wider than that, in
the hundreds of bits (for the internal state). Reasonably fast, too.

-- glen

robin

2007-06-23, 8:06 am

From: "glen herrmannsfeldt" <gah@ugcs.caltech.edu>
Sent: Wednesday, June 20, 2007 4:55 AM

> Arjen Markus wrote:
>
> (snip)
>
>
> These days 32 bits (or 31) is often not enough for a random
> number generator. There are many that are much wider than that, in
> the hundreds of bits (for the internal state). Reasonably fast, too.


I would say, more than "reasonably fast".
You should take a look at G. Masaglia & W. Tsang's paper,
"The 64-bit Universal RNG".


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com