11
votes
Accepted
Invalid conversion from runtime type String to Double
If you are going to cast a variable, you’re most likely doing what’s known as a downcast. This means that you’re taking the Object and casting it into a more “specific” type of Object. Here’s an ...
6
votes
Round Double to three Decimal places
As there is no method called setScale available for Double class, you are getting that exception. setScale method is available for Decimal class.
The scale (number of digits to the right of decimal ...
1
vote
Accepted
Are constants for NaN, NEGATIVE_INFINITY, POSITIVE_INFINITY available in Apex logic for Double?
I found this way of creating the infinity constants which is the main part of what I need:
final Double POSITIVE_INFINITY = Math.pow(10, 300) / Math.pow(10, -300);
final Double NEGATIVE_INFINITY = -...
1
vote
Are constants for NaN, NEGATIVE_INFINITY, POSITIVE_INFINITY available in Apex logic for Double?
We don't have very many constants at all, aside from the system enums, two constants in Math (E and PI), that's about it. You'll need to adjust the algorithm to detect those conditions directly. I'd ...
1
vote
Accepted
Is Scientific notation allowed in double
Yes, apex does not allow scientific notation in double, which means you cannot assign scientific notation value to a double variable as shown below
Double d = -2.347774E-10;
OR
sObjRec....
1
vote
Accepted
Convert double to String
Found out the the formula field that I was refering only had 6 decimals.
The correct way to convert double to string is: string.valueof(acc.acc_latitude__c)
1
vote
Decimal or double?
The Decimal, Double, and Float variable types are different in the way that they store the values. Precision is the main difference where float is a single precision (32 bit) floating point data type, ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
double × 12apex × 6
string × 2
decimal × 2
javascript × 1
api × 1
visual-workflow × 1
query × 1
formula × 1
error × 1
webservices × 1
c# × 1
navigation × 1
conversion × 1
lightningnavigation × 1
navigationmixin.navigate × 1
header × 1
sobjectfield × 1
number × 1
casting × 1