MongoDB C# offi : Lat, Lng as doubles are stored at precision13 and rounding? -
i store lat , lng double in mondodb , c# official driver. have problems points not matching right places after rounding of double values internaly in mondodb(by driver or intern). have searched posible rounding before post repository haven´t found anything. why not use decimal, because query.near use doubles.
v1.6.5 ; c#v0.11 ; win64.
xx.444057295828145;xx.63416004180907 captured string xx.444057295828145;xx.63416004180907 receipt repository before save method inside mongodb , returned : xx.4440572958281, xx.6341600418091, saved , returned (only 13 after dot)
this resulting moved map. advices. thanks.
i use update method
public void savegeopoints(string id, string lat, string lng) { //--> xx.444057295828145;xx.63416004180907 db.repository.update( query.eq("_id", id), update.set("lat", double.parse(lat)) .set("lng", double.parse(lng))); }
the default format console.writeline prints 13 digits after decimal point. following code snippet shows this
var test = "10.444057295828145"; console.writeline(test); var testindouble = double.parse(test); console.writeline(testindouble); console.writeline(testindouble.tostring("r")); console output 10.444057295828145 10.4440572958281 10.444057295828145
Comments
Post a Comment