I wrote a routine that accrued all money entries
into a variable called 'mproof'.
When checked if the running total was ZERO
eg DO WHILE .T.
* ... my data entry code
IF mproof = 0
* allow exit
EXIT
ENDIF
ENDDO
the routine decided it was NOT EQUAL to ZERO and looped
around.
I tried the same values with a calculator and the result
was actually ZERO !!! What the blazes?...
So I changed my program to compare the accrued total as
VAL(STR(mproof,10,2)) and then the routine worked
perfectly!!
My question is:-
How can a programmer ensure that a value of ZERO
is really and truly ZERO?
Cheers,
Jim
into a variable called 'mproof'.
When checked if the running total was ZERO
eg DO WHILE .T.
* ... my data entry code
IF mproof = 0
* allow exit
EXIT
ENDIF
ENDDO
the routine decided it was NOT EQUAL to ZERO and looped
around.
I tried the same values with a calculator and the result
was actually ZERO !!! What the blazes?...
So I changed my program to compare the accrued total as
VAL(STR(mproof,10,2)) and then the routine worked
perfectly!!
My question is:-
How can a programmer ensure that a value of ZERO
is really and truly ZERO?
Cheers,
Jim