The Number 1 independent website for ACL information!

TexasACL User Group
About Us
Training
Why ACL
Essays & Scripts
ACL News
Events
Links
FAQ
Site Map
Support Us
Fixed Point Math

There is something that people who are not familiar with ACL should know about ACL's math processing.  In ACL the following is not a true statement:
 
10/3*3=10
 
But the following are:
 
10/3*3.0=9.0
10/3.0*3=9.9
10.0/3*3=9.9
 
Why is this?  Because ACL uses a type of math called "Fixed point Math."  It's used to increase the speed of processing.  What does it mean?  It means that ACL will determine the number of decimal points remembered by the system based on the number of decimal points indicated in the first mathematical process it works in an equation.  EG commands in parenthesis are done before those not in parenthesis.  Multiplication/division before addition/subtraction, etc.  If using a conditional statement, the number of decimals will be determined by the default value.
 
Thus, 10/3*3.0, the computer will take 10/3 and remember "3" rather than 3.33333.... It will then base ALL Mathematical transactions for that record based on that criteria from that point forward.  Also, remember it is based on the first mathematical transaction worked.  In other words, Remember your rules for brackets, multiplication, division, etc.
 
One way around this is to include a multilpier of "1.00*" where you have the number of decimal points you need/want.  (I usually go one or more beyond what I want to make sure rounding errors are minimized.)  If you aren't familiar with this, you might over present your numbers as actual as compared to approximate.  Other ways include the use of DEC() function.