[LCP]Re: For Nick and Srinath

Mike & Penny Novack stepbystepfarm at shaysnet.com
Fri Jul 27 02:47:05 UTC 2001


I'm going to try to help with two questions via a single attachment. No
need to try to understand all that this program is doing as you are
unlikely to be wondering about the speed at which a population of C.
dentata might become resistant to the fungus C. parasitic dependent upon
the relative selection of partially resistant trees based upon the
number and distribution of resistance alleles.

Srinath:
    This is an example of a program that allows runtime parameters in
the sense that I understand that term. It first processes "options"
which specify other than normal running, then if these are not present,
obtains the parameters necessary for a normal run (a bunch of numbers).

Nick:
    Take a look at the function "flip"*, especially the cast of
RAND_MAX to double before adding 1 to it. The reason is that depending
upon the implementation, RAND_MAX may already be the maximum possible
float (in which case trying to add 1 to it won't give you what you
expect). Even if you don't care about portability you should check out
what your implementation does with:
    float x, y, z;
    x = RAND_MAX ;
    y = x + 1;
    z = y - 1;
    printf("%f %f %f \n", x, y, z);

    Then try again with "double x, y, z".

* -- The flip of a (possibly biased) coin. You want a 50-50 flip so you
would call this function with the constant 0.50 (that's a variable in my
program since the selection of alleles depends upon their relative
frequencies in the parental generation.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Chestnut.c
Type: application/octet-stream
Size: 19854 bytes
Desc: not available
Url : http://lists.linux.org.au/pipermail/linuxcprogramming/attachments/20010727/0382b8f5/attachment.obj 


More information about the linuxCprogramming mailing list