Point::new and casting of location coordinates
aetelani opened this issue · 1 comments
I am just making some simple tests with rust and I some mildly interesting casting handling where creating new Point actually takes what ever values is given even Point is shorter. Conversion back to f64 just prints something garbage. Not very safe I think.
use geocoding::{Point};
struct Mining {
id: u64,
location: Point<f32>
}
fn main() {
let mine = Mining{ id: 1, location: Point::new(2.128703454232323, 41.40139) };
println!("Hello, world! {lat}", lat= mine.location.x() as f64); # Hello, world! 2.1287033557891846
}
This has nothing to do with geocoding: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=78a6084509f482cdd5433d5d4f218fab
You appear to be running out of precision when defining location
. I would gently encourage you to familiarise yourself with the semantics of Rust's floating-point implementation before claiming that a particular library is doing something odd, especially given that it is readily discernible that the Point
implementation and x()
method don't alter numerical input or output in any way.