As a by-product of my discussion with David M and Daniel Bruckner under this answer and partially incorrect expression from myself under this answer of Adam , it became clear that, unfortunately, all the answers are only partially correct. What's happening:
// example (all x, y, z ar ints):
Decimal d = x + y + z / 60M;
// is left to right evaluated as
Decimal d = x + y + (((Decimal) z) / 60M);
// when doing addition, this is what happens when you add integers and something else:
Decimal d = x + y + (int) (((Decimal) z) / 60M);
// which will yield a truncated result.
: 60M 60.0 , , ( ) , / /, OP.
, / , ( ) , , :
Decimal GetDecimalLatitude(Decimal latitudeHours, Decimal latitudeMinutes, Decimal latitudeSeconds)
{
return latitudeHours + (latitudeMinutes + (latitudeSeconds / 60)) / 60;
}
. :
converterDecimalCoordinates.Latitude = GetDecimalLatitude(
CartesianCoordinates.LatitudeHours,
CartesianCoordinates.LatitudeMinutes,
CartesianCoordinates.LatitudeSeconds);