Unable to convert to the Javascript Number

Unable to convert to the Javascript Number

  

Hi,

Currently we have a formula to calculate distance between coordinates on client side but we are getting this error:

Unable to convert 0.67449695821270764679665 to the Javascript Number type because it will lead to precision loss. The maximum safe number of digits after the decimal point is 16.

Where should the precision be set?

hmm, this is weird.

doing it in the console i get no problem at all


when you define a Local Entity you can specify the precision of the Decimal attributes (and the limits are stricter actually, you cannot have more than 8 decimal digits).

I never got the error you're experiencing, but you may want to try using Round(0.67449695821270764679665, 16) on the assignment...

Hi Jorge,

Thank you for your reply - I've also come to using Round() function and managed to fix error by using round() function before sending parameters like this 

SyntaxEditor Code Snippet

Acos(Round(Sin(Round(PI()* testLatitude/180,15)) * Sin(Round(PI()*testLatitude2/180,15)) + Cos(Round(PI()*testLatitude/180,15)) *Cos(Round(PI()*testLatitude2/180,15)) * Cos(Round(PI()*testLongitude2/180 - PI()*testLongitude/180,15)),15))*6371

in this example trigonometric functions are client side wrappers for JS Math.* functions, I've also had to use Round() inside this functions when assigning JSNode output to function output.

I was wondering if it is something that should be done automatically behind the scenes without manual apply of round()?


Thanks