|
From: Daniel J S. <dan...@ie...> - 2010-12-29 02:39:13
|
Ethan Merritt wrote: > On Tuesday, December 28, 2010, Daniel J Sebald wrote: > >> Ethan Merritt wrote: [snip] >> A couple odd things however. Why is the limiting value >> 017777777777UL? Is that some bad way of obtaining the maximum 32 >> value of 2^32-1, i.e., 4294967295? > > I think the intent is to make sure that the integer value didn't > overflow before being converted to (double). Off the top of my head, > I can't explain why the test isn't against 037777777777 instead. > > > >> If not, then it should be >> >> if (real(init) >= (double)(04294967295UL)) >> int_error(NO_CARET,"Illegal seed value"); if (imag(init) >= >> (double)(04294967295UL)) int_error(NO_CARET,"Illegal seed value"); > > > Why? All bits set is easy to remember; the numerical value > 4294967295 - not so easy. Oh yeah, octal. I'm used to thinking either decimal or hex. Right, 10 sevens is 30 bits equal 1, so 2 more bits would be a value of 3. 037777777777UL makes more sense. [snip] >> Regarding the out of date comment, did it mean that seed1 and seed2 >> should be 64-bit, i.e., long long? > > > Upon reflection, I think the comment is pointing out that since we > just disallowed any values with the high bit set you can only set the > low 31 bits of each half. I.e. only 62 of the 64 bits can be set. Shouldn't be a problem if using 037777777777UL. As you pointed out, placing one seed in the real component and one seed in the imaginary component is a bit peculiar. Can the rand() function simply have two optional inputs? Dan |