http://qs321.pair.com?node_id=386949


in reply to Re: Problem Domains and Multiple Disciplines
in thread Problem Domains and Multiple Disciplines

That's a bad idea. You should code it as

my sum = 100 * 101 / 2;
or something like that.

I know this from practice, as I once accidentally wrote 8092 instead of 32*256 in a program and had a hard time finding out why it wouldn't work. A computer can do arithmetic better than any of us.

Replies are listed 'Best First'.
Re^3: Problem Domains and Multiple Disciplines
by BrowserUk (Patriarch) on Aug 30, 2004 at 16:43 UTC

    I did it with a computer...in the shape of a calculator:)

    I get your point, but unless the constants 100, 101 and 2 have some meaning in context, you've just advocated magic numbers.

    A well named constant, that made sense in context, would be preferable.


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "Think for yourself!" - Abigail
    "Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon