Question about checks for min and max values
Nancy Palmquist
nlp at vss3.com
Mon Jul 25 10:11:47 PDT 2005
Jay R. Ashworth wrote:
> On Fri, Jul 22, 2005 at 06:39:39PM -0400, Brian K. White wrote:
>
>>You think "" eq "0" is bad? You should have heard me when I first discovered
>>that "abcdefg" eq "abc" !
>>But even that is perfectly OK and logical and useful (actually _very_
>>useful) and doesn't get in the way or cause any problems as long as you know
>>about it.
>
>
> It may be useful, but I continue to assert that it is neither logical,
> nor OK.
>
> The semantics of "=" are *very* well defined in the discipline of
> programming language design, and language designers override them at
> their peril. Spelling it differently (ie: "eq") doesn't *really* get
> you off the hook.
>
The correct mathematical definition for a IF line "eq" or slang "=" is
equivalent. Equivalent is not the same as Equal
I try never to use the "=" on IF lines because it is not a symbol for
equivalent, it offends my BS in Mathematics.
I think that is the basic issue in this thread. People are reading the
"=" on an IF line as an algebraic "=" (Equality).
These symbols are used differently in programming. When we write:
THEN: ab=5+"1"
we do not mean to do an algebraic equality, we mean to assign the value
of 5+"1" to the variable ab. If you think about it, after the action is
completed it is algebraically equal but not before.
On an Equalalent comparison, two values are compared and determined
equivalent. It does not mean they are equal, the rules are different,
as many have come to terms with in filePro, but I do not see the filePro
rules as violating the mathematical definition of equivalent. An
equivalent comparison is usually a one to one comparison of two values,
until you run out of things to compare (literal equivalent). Or a
numeric equivalent compares two values to see if they are equal. This
comparison requires them to be changed to like types (same edit) and
then compared. This is the issue. Changing different typed values to
the same type, may corrupt the number minutely, but enough to cause the
comparison to be misleading. For example, "0" might change to
".00000000001" very close but not the same.
Keep this in mind and watch the edits you use to make sure all
arithmetic is using appropriate edits. Never use $ or # edits in an
arithmetic statement, it will mess you up. These are literal edits for
formating output not storing numbers.
Nancy
--
Nancy Palmquist MOS & filePro Training Available
Virtual Software Systems Web Based Training and Consulting
PHONE: (412) 835-9417 Web site: http://www.vss3.com
More information about the Filepro-list
mailing list