# Differences

This shows you the differences between two versions of the page.

 — control_invalid_floating_point_operation [2019/01/27 11:28] (current) Line 1: Line 1: + =Error Message= + + + + The user received an "​Invalid Floating Point Operation"​ when creating or editing an order or estimate. + + + + =Explanation of Error= + + + + A "​floating point number"​ is computer-speak for a decimal number. ​ An "​operation"​ in this case is a math operation. ​ In practive, almost every "​floating point operation"​ error you will get is a Division By Zero problem. ​ (Others exist, but are extremely infrequent.) + + + + This is almost always a case where Control is attempting to divide by a variable (usually quantity) that is zero.  For example to get the unit cost they might take   ​**MaterialCost/​Quantity** ​ but if Quantity is zero and the users doesn'​t consider this they will get either a "​Division By Zero" or a "​Floating Point Operation"​ error. + + + + =Severity= + + **Normal**. This affects the users ability to work this the affected product or any order/​estimate containing it. + + + + =Possible Root Cause(s)= + + + + ==#1 Bad Quantity Formula== + + + + 9/​10/​2011>​ Several users has the following formula as the formulat for Quantity in the product setup. + + + + [[code_formatpascal|code_formatpascal|code format="​pascal"​]] + + + + ParentVariableValue(Quantity,​ 0) + + + + <​code>​ + For child line items, this worked fine.  However, if that was promoted to or added as a top level item, it caused this error. + ===== Resolution ===== + Correct the affected formula to: + [[code_formatpascal|code_formatpascal|code format="​pascal"​]] + + + + ParentVariableValue(Quantity,​ 1) + + + + <​code>​ + The following SQL can be used to identify all the products with this specific issue: + [[code format="​sql"​]] + + + + Select Item.ID as ProductID, Item.ItemName as Product, V.Formula + + + + From Variable V + + + + Join PricingPlan PP on PP.ID = V.PricingPlanID + + + + Join CustomerGoodsItem Item on Item.ID = PP.GoodsItemID + + + + Where Formula like '​%ParentVariableValue(%,​0)%'​ + + + + and VariableName = '​Quantity'​ + + + + <​code>​ + ===== Version Information ===== + * Reported : 09/2011 + * Version(s): 3.5+