Something about Numbers in WEM:
The numeric input field allows for numbers to be added up til 18 digits (1234567890123456768). Adding more numbers into a numeric input field will show the fault message "this is not a valid number".
BUT: According to an international IEEE standard that also Microsoft uses in their applications (Excel, DotNet), actual typed numeric values are stored using a 15-digit precision.
So, numbers with more than 15 digits can not be correctly handled as real numeric values and should be handled as strings/texts when generated or mapped or stored in database.
Just an example we encountered testing an Export to XML, using large numbers:
123456789012345 (15 digits) >> -2147483648
>> directly mapped to output XML, yields a negative max-int32 because of a signed-int situation in XML standard definition I guess - seeing posts about maxInclusive to be 2147483647 and minInclusive to be -2147483648
ToString(1234567890123456) >> "1234567890123456"
>> correct and usable
FormatNumber(1234567890123456, 0, false, nl_NL) >> "1234567890123460"
>> ah... slight difference because the 16th digit can not be used in the precision, so it gets rounded to the 15-digit precision and gets a 0 appended
Same options (direct numeric, ToString and FormatNumber) with an 18-digit number start showing the scientific E-notation (10 to power of n):
1234567890123456768
- 1.2345678901234568E+18 (direct numeric)
- 1,2345678901234568E+18 (tostring based on active language)
- 1234567890123460000 (formatnumber)
This should be considered NOT a bug, but rather as a situation where those large numbers with more than 15 digits should be considered a text and always be handled as Text (so stored in text-fields and no numeric functions applied).
Exporting such numbers to XML are using the XML definition for int (max 10 digits and maxInclusive to be 2147483647 and minInclusive to be -2147483648).
Exporting to JSON is able to use the numeric values up to 15 digits.
So - I hope you can find this little post when you encounter strange results due to numeric values with 15+ digits.
Ralph - WEM Xpert since 2011
"I speak to machines with the voice of humanity"
-- Marillion, Man of a thousand faces --