diff --git a/spatial-coordinate-systems/src/dmm.rs b/spatial-coordinate-systems/src/dmm.rs index 5774c50..dfc990f 100644 --- a/spatial-coordinate-systems/src/dmm.rs +++ b/spatial-coordinate-systems/src/dmm.rs @@ -108,7 +108,7 @@ impl DMM { pub fn from_decimal_degrees(d: f64, is_latitude: bool) -> Self { let degrees = d as i16; - let minutes = d.fract() * 60_f64; + let minutes = d.abs().fract() * 60_f64; let (degrees, direction) = normalize_degrees_direction( degrees, diff --git a/spatial-coordinate-systems/src/dms.rs b/spatial-coordinate-systems/src/dms.rs index 6eb94fd..3714b8b 100644 --- a/spatial-coordinate-systems/src/dms.rs +++ b/spatial-coordinate-systems/src/dms.rs @@ -108,7 +108,7 @@ impl DMS { pub fn from_decimal_degrees(d: f64, is_latitude: bool) -> Self { let degrees = d as i16; - let minutes = d.fract() * 60_f64; + let minutes = d.abs().fract() * 60_f64; let seconds = minutes.fract() * 60_f64; let minutes = minutes as i16; @@ -187,7 +187,6 @@ mod tests { eprintln!("Testing: {} => {:?}", $tt, cvt); assert!(cvt.is_ok()); eprintln!("Now converting to latlon"); - // assert!(dbg!(TryInto::::try_into(cvt.unwrap())).is_ok()); }}; ($tt:tt, DMS) => {{ let cvt = DMS::parse($tt);