Calculating in Formever
Formever is designed for business systems. One of the ways this becomes apparent is how Formever supports quantities with units and rates.
Traditional big vendor business systems designed around a general purpose database represent a quantity as just a number. There’s no inherent knowledge in the system that this number is US dollars and that number is a price in $/ton. That knowledge rests with the programmer of the system. They need to recognize and handle properly the multiplication of the two numbers and realize the results are a dollar amount. This has the potential for expensive mistakes.
Formever is much smarter about quantities. In Formever a quantity is a number and a unit. That means that the sale price for fertilizer is a quantity of $/ton. So when an order for 5 tons is entered into the system and fertilizer sells for $25/ton the order line extension is $25/ton * 5 tons and the result can only be $125. How does this happen?
In the Formever business system for this fertilizer company the order line extension amount is defined as taking the price of the item ordered and multiplying it by the amount ordered. Formever knows that for a multiplication definition that the product of two quantities must make sense. If one quantity (item price) is a ratio ($/ton) and the other quantity is an amount (ton) then the product result can only be a quantity of dollars.
Formever ensures that only sensible things are being done.
One important business need is that quantities have to be rounded when calculations are done.
When quantities are calculated in Formever there is an option to round the result to a given number of decimal points. For example to round to an exact number of pennies(2 decimal points) $5.334 would be rounded to $5.33 (the desired value).
Sometimes rounding to the nearest whole number is desired, which would be 0 decimal points. Sometimes, like in the example of stock prices, rounding to 4 decimal points is the standard.
The number of decimal points to round to is the desired ‘precision’ of the quantity.
For example if the calculation is a division of 1.0 /3.0 the result is .3333333… (Formever will go to 18 decimal places if desired). Let us suppose the result is to be in a currency with two decimal places (almost all currencies are kept to two decimal places, but there are exceptions like the Japanese Yen which is usually kept to whole number). .3333.. would normally be rounded to .33 as it is closer to .33 than to .34.
A complication arises when numbers are halfway between two numbers of the desired precision.
For example .335 . Do we round that down to .33 or up to .34?
Different organizations have different rules and that is why Formever supports four rounding methods:
- Banker’s – round to the closest desired value, if the result is halfway then round up if the previous digit is even, round down if it is odd
- To Lower – just round down.
- To Upper – just round up,
- Half Up – this rounds to the closest but if it is halfway between two possible values then round up.
The default method is Half Up.
It used to be that Banker’s rounding was the most common. These days, however, many businesses staff will just round quantities like .335 to .34. Even though Banker’s rounding tends to produce an overall rounding error of 0 over a large number of calculations, the simplicity of Half Up seems to be more the norm.
Rounding methods are not something that a designer can create. They are hardwired into the calculation engine of Formever. So if you require some specialized rounding method that is not one of the 4 ones above you will have to contact Formever and ask for an enhancement to incorporate it.