FOR lnDecimal = 0.005 TO 0.115 STEP 0.01 lnExpected = ROUND(lnDecimal,2) FOR lnValueBasic = 1 TO 200 lnValue = lnValueBasic + lnDecimal lnValueLong = ROUND(lnValue,11) lnValueRound = ROUND(lnValueLong,2) lnDifferenceBasic_Round=lnValueRound-lnValueBasic && has to be lnExpected IF lnDifferenceBasic_Round <> lnExpected MESSAGEBOX('lnDecimal='+ALLTRIM(STR(lnDecimal,10,3))+', lnBasicValue='+ALLTRIM(STR(lnValueBasic,10,0))) ENDIF ENDFOR ENDFORAlso the number of decimals can make a difference in the result:
FOR lnDecimalRound = 11 TO 12 FOR lnValueBasic = 1 TO 128 lnValue = lnValueBasic + 0.325 lnValueLong = ROUND(lnValue,lnDecimalRound) lnValueRound = ROUND(lnValueLong,2) lnDifferenceBasic_Round=lnValueRound-lnValueBasic && has to be 0.33 IF lnDifferenceBasic_Round <> 0.33 MESSAGEBOX('lnDecimalRound='+ALLTRIM(STR(lnDecimalRound,10,0))+', lnBasicValue='+ALLTRIM(STR(lnValueBasic,10,0))) ENDIF ENDFOR ENDFORPlease help! I'm losing it... I use this round() function a lot!!! And i mean thousands of times in my app's...