function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
BlueteeBluetee 

question about the Number type

The maximum lengh for a number type defined in salesforce platform is 18 digits. But in Java, it will round number more than 16 digits. Thus, if I define a number in salesforce which is 17 or 18 digits, say 12345678901234567 for example. It will be rounded to 1.2345678901234568E16 in Java.
 
Does it mean the value will be changed if it is processed by a Java program?
 
The double type in Java is defined follow the IEEE 754 standard. I would like to know why Salesforce.com allows a number maximum to 18 digits. And how could I deal with such a big number using Java code.
werewolfwerewolf
Java has special classes to deal with large integers, like BigInteger.  I'm not sure how that works with the API, however.  Do you need to work with numbers that large?
BlueteeBluetee
My concern is, why Salesforce allows user to define a number which has more than 16 digits.
werewolfwerewolf
Why wouldn't Salesforce allow that?  There could conceivably be customers who might need that many digits.  If you'd like to restrict your users to 16 digits or less you could write a validation rule that prevents them from setting more than that.