WGS84-coordinate encoded as Integers I want to store WGS84-coordinates in two integers for latitude and longitude instead of floats to get a higher precision than with floats.

Here's my code:

struct Coordinate
{
    private int latitude;
    private int longitude;

    const double latMin = -90.0f;
    const double latMax = 90.0f;
    const double lngMin = -180.0f;
    const double lngMax = 180.0f;

    public Coordinate(double latitude, double longitude)
    {
        this.latitude = mapDoubleToInt(latitude, latMin, latMax);
        this.longitude = mapDoubleToInt(longitude, lngMin, lngMax);
    }

    public double Latitude { get { return mapIntToDouble(latitude, latMin, latMax); } }
    public double Longitude { get { return mapIntToDouble(longitude, lngMin, lngMax); } }

    private static int mapDoubleToInt(double value, double min, double max)
    {
        return (int)(((long)int.MaxValue - int.MinValue) * (value - min) / (max - min) + int.MinValue);
    }

    private static double mapIntToDouble(int value, double min, double max)
    {
        return ((double)value - int.MinValue) / ((long)int.MaxValue - int.MinValue) * (max - min) + min;
    }   
}


I'm not sure if there is a better to convert the data. There are a lot of casts and arithmetic operations in it -- any way to do this more elegantly?
you can avoid stuffing everything in a one-liner:

private static int mapDoubleToInt(double value, double min, double max)
{
    long intRange = 1L &lt;&lt; 32; // ==((long)int.MaxValue - int.MinValue)
    double inputRange = max - min;
    return (int)(intRange * (value - min) / inputRange + int.MinValue);
}

private static double mapIntToDouble(int value, double min, double max)
{
    long intRange = 1L &lt;&lt; 32; // ==((long)int.MaxValue - int.MinValue)
    double inputRange = max - min;
    return inputRange * ((double)value - int.MinValue) / intRange + min;
} 


After reordering the operations it's now clearer that they are opposites. Especially after extracting the range as variables.