Siebel eScript Language Reference > Using Siebel eScript > Coding with Siebel eScript >

Preventing a Floating-Point Error


CAUTION:  Saving a floating-point number in a variable might cause a loss in precision due to a memory limitation for decimal-to-binary conversion.

Siebel CRM can store a decimal number that does not convert to a finite binary representation with only a small precision error. For example, the following statement might result in Siebel CRM storing VariableA as 142871.450000000001:

var VariableA = 142871.45

A small precision error will likely have little effect on the precision of a subsequent calculation, depending on the context where you use the number.

A number might be too large for the field that Siebel CRM uses to display it, resulting in an error message that is similar to the following:

Value too long for field %1 (maximum size %2)

To prevent a floating-point error

  • Use the Convert Number to Fixed Decimal Method method at an appropriate location in the calculation or when you save the value in a variable.

    For example, use x.toFixed(2) in a calculation instead of using VariableA. For more information, see Convert Number to Fixed Decimal Method.

Siebel eScript Language Reference Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Legal Notices.