Skip to main content
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 ...
Oleksandr Berehovskyi's user avatar
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 ...
Vijay Ganji's user avatar
  • 6,666
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 = -...
Keith C's user avatar
  • 137k
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 ...
sfdcfox's user avatar
  • 502k
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....
Azeez's user avatar
  • 103
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)
ChristianJuul's user avatar
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, ...
Rajesh's user avatar
  • 119

Only top scored, non community-wiki answers of a minimum length are eligible