Precision in Map widget

I can’t send location to map widget with float variable 7 decimal places.
when I send with float variable it maybe reduce to 4(about) decimal places
because I compare between float variable and decimal numeric in same value but it not same point on map.

How I can send it in 7 decimal places with float variable.

this some code

float flat, flon; // from GPS Module, assume flat = 13.7414551254, flon = 104.2797241157

if(SendToBlynk)
{
myMap.location(0, flat, flon, “CURRENT”); //float variable
myMap.location(1, 13.7414551, 104.2797241, “.7f”); //decimal numeric

  Serial.println(flat,7);
  Serial.println(flon,7);
}

Serial Monitor out

13.7414551
104.2797241

details :
• Hardware model + communication type. : ESP32 + WiFi
• Smartphone OS : Android V8.0.0
• Blynk server
• Blynk Library version 0.5.2

your using float which has limited precision. More precision can be gained from using either double or long double types. Bit weird though cause IRC a float @ 32bit should be able to contain 7 decimals… anyway, just try the different types and see where it gets you.

2 Likes

I change float to double it worked.
Thankyou very much.

1 Like