How to store GPS coordinates temporarily?

Hii , i wanted to store the gps co-ordinates in a temporary variable for later using for comparing in nested if loop in the " displayInfo()" but i am unable to store the gps co-ordinates using this function "(gps.location.lat(), 7)" and i need 7 decimals after point eg:15.7845621, the function is only applying for just printing "Serial.println(gps.location.lat(),7);" when i use same to declare to variable "float lat= (gps.location.lat(),7);" it's not working and the output is 0.00 getting. I am TinyGPSPlus library. Please reply if anyone knows how to store the coordinates (after point 7 decimals) temporarily.! Below is the code. let me if there other function which can return gps values to variable.

#include <TinyGPSPlus.h>
#include <SoftwareSerial.h>

static const int RXPin = 4, TXPin = 3;
static const uint32_t GPSBaud = 9600;


// The TinyGPSPlus object
TinyGPSPlus gps;

// The serial connection to the GPS device
SoftwareSerial ss(RXPin, TXPin);

float lat= (gps.location.lat(),7);
float lng= (gps.location.lng(),7); 

void setup()
{
  Serial.begin(9600);
  ss.begin(GPSBaud);

  Serial.println(F("DeviceExample.ino"));
  Serial.println(F("A simple demonstration of TinyGPSPlus with an attached GPS module"));
  Serial.print(F("Testing TinyGPSPlus library v. ")); Serial.println(TinyGPSPlus::libraryVersion());
  Serial.println(F("by Mikal Hart"));
  Serial.println();
}

void loop()
{
  // This sketch displays information every time a new sentence is correctly encoded.
  while (ss.available() > 0)
    if (gps.encode(ss.read()))
      displayInfo();

  if (millis() > 5000 && gps.charsProcessed() < 10)
  {
    Serial.println(F("No GPS detected: check wiring."));
    while (true);
  }
}

void displayInfo()
{
  Serial.print(F("Location: "));

  if (gps.location.isValid())
  {
  
    delay(1000);
    Serial.print(lat);     //lat
    Serial.print(F(","));
    Serial.print(lng);
    Serial.println();

    //for comparing
    if (lng < 78.0773770  && lng > 78.0770490 && lat < 15.7964630 && lat > 15.7961940)
    {
      Serial.println("ECE block arrived");
    }
    else
    {
      Serial.println("moving to next block");
    }
  }
  else
  {
    Serial.print(F("INVALID"));
  }

 
  Serial.println();
}

Use this instead:

float lat= gps.location.lat();

Float variables support at most 7 decimal digits of precision, including the integer part.

Use type "double" for more digits, but keep in mind that double is not supported on the Arduino Uno, Nano and Mega, and is instead treated as float.

hi i am getting only upto 2 decimals after point. pls see below pic

Use Serial.print(lat, N); to print N places past the decimal point.

Because that's the default for the print functions.
If you want more, specify more.

See post #2. "lat" is a variable.

By specifying more places when you print them

for printing it is coming but for comparing it's not coming

For questions about code, post the code, using code tags, and describe what you expect to happen, and what happens instead.

if that is case but for comparsion it's not coming all digits

I'm sorry, I don't understand that sentence.

for below code I want the ouput to be 7 decimals after point but i am getting just number 7 which is right side.

float lati,lngi; 

lati= (gps.location.lng(),7);
lngi= (gps.location.lng(),7);
Serial.print(lati);     //lat
Serial.print(F(","));
Serial.print(lngi);
Serial.println();

for below code I want the ouput to be max decimals after point but i am getting only 2 decimals

loat lati,lngi; 

lati= gps.location.lng();
lngi= gps.location.lng();
Serial.print(lati);     //lat
Serial.print(F(","));
Serial.print(lngi);
Serial.println();

for below code i am getting 7 decimals but i am unable to store it in temparory variable with 7 decimals. the function "(gps.location.lng(),7) ;" It's applying just for printing not storing

loat lati,lngi; 

lati= gps.location.lng();
lngi= gps.location.lng();
Serial.print(lati ,7);     //it will be same as "(gps.location.lng(), 7);"
Serial.print(F(","));
Serial.print(lngi,7);
Serial.println();

just i need function like gps.location.lng() with required no. decimals to store temporary in variable for comparison in "if loop " in "displayInfo" in above code.

Comparison is equals "==", which often does not work for floats, less than "<" or greater than ">".

The number of decimal places does not enter into a comparison operation.

Explain what you really want to do, and we can help.

Do you understand what the comma operator does?

If not, stop using it.

i mean specifer is applying only for printing but not applying for storing into variable in float type upto 7 decimals for comparing in if loop

You cannot define the number of decimal places in a float value. That number is meaningful only for printing.

Keep in mind that for many numbers, there is no exact representation as a float value.

If you assign, you assign the whole value, including as many decimal places as the right hand of the assignment has.
You cannot change that behaviour, assuming the datatypes are identical.

pls see above post i replied if i dont use "," i just get only 2 decimals.

lati= gps.location.lng();

No.
You are wrong.

When you print, without specifying the number of decimals.

Why not take a little time to learn the language basics?