I have the following double from salesforce as a number = Latitude = 50.916408140415314

I want to convert it to a string. However when I convert it to a string like this: string.valueof(latitude) i only get the result: 50.935628

Can anyone point me in the direction of what might be wrong?

  • 1
    Found out that it was not the code, it was the formula field that I was referring that only had 6 decimals. For some reason Latitude and longitude can not be access from code. So they had created a formula field with less decimals and that confused me. Jan 10, 2018 at 13:31
  • 2
    If your comment provides closure to the issue you should submit it as an answer and then accept the answer for anyone in the future that may have a similar issue.
    – JaredT
    Jan 10, 2018 at 13:48

1 Answer 1


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)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .