Re: [off-topic] math techniques ;) (was exp formula)

From: George (greerga@CIRCLEMUD.ORG)
Date: 02/02/98


On Mon, 2 Feb 1998, ;P wrote:

>> >"exp = pow(2, level) * 1000" will give you something close to the above
>>
>> Ugh, try 'exp = level * level * 1000;'  It'll eliminate a function call,
>> give the same results and not require the math library.
>
>mmm...well..i meant 2^level (which is very different from level^2)..might
>have had the pow call backwards :)

No, it's not backwards but I assumed you meant (level,2) because (2,level)
will get really large really fast. (30 levels will be at 1 billion,
anything much farther above that won't fit in an integer.

>> Out you evil daemons of nested externs!
>> (Try -Wnested-extern on CircleMUD and you'll see what I mean.)
>
>so..i guess this is bad? any particular reason? it's used quite a bit
>other places in the code (i'm thinking of nanny() in particular)..

It's debatable, mostly a matter of style.  My thought is that if you have
enough extern statements strewn about, why not put them in a header
somewhere? (or at least centralize.)

--
George Greer  -  Me@Null.net   | Genius may have its limitations, but stupidity
http://www.van.ml.org/~greerga | is not thus handicapped. -- Elbert Hubbard


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST