Laurie Alvey wrote:
You can even avoid the NTOM() calls if all variables are initialised to
currency type like this:
CLEAR
nNum = $0.01
nRate = $0.21
STORE $0 TO nVat, nGross, nMulti
DO WHILE nNum < $100000
nVat = ROUND(nNum*nRate,2)
nGross = nNum + nVat
nMulti = ROUND(nNum*(1+nRate),2)
IF nGross <> nMulti
? 'Value ' + STR(nNum,9,2) + ' differs. ' + STR(nGross,10,2) +
STR(nMulti,10,2)
EXIT
ENDIF
nNum = nNum + $0.01
ENDDO
? "Finished."
Well you learn something new every day. Never actually used currency
variables before so will definitely be looking at them in the future and
thinking about it there are places where I should be using currency
field types but at the moment just use say N(12,2)
Thanks,
Peter
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.