Closed arif2009 closed 8 months ago
those are numbers (i.e float64) so it's all about how you display
fmt.Printf("%v\n", math.Pi)
fmt.Printf("%f\n", math.Pi)
fmt.Printf("%.8f\n", math.Pi)
returns
3.141592653589793
3.141593
3.14159265
@paulmach It is not working because here https://github.com/paulmach/orb/blob/v0.9.0/define.go#L8 it restrict upto 6 decimal places
that's DefaultRoundingFactor
used for rounding. And you can change it
Can you provide some more context on "always returns 6 decimal places". What returns only 6?
My code is like this:
m := minGeomScan.Geometry.(orb.Point)
ml := jsonschema.LatLon{
Lng: m.Lon(),
Lat: m.Lat(),
}
where m.Lon() & m.Lat() always returns up to 6 decimal places, but I need it to make 8.
m.Lat() and m.Lng() do not return 6 decimal places. They return a float64.
This is related to you're input, how you're parsing data to create the minGeomScan
or your output, how you can see the 6 decimal places.
how you can see the 6 decimal places.
I see it from O/P data, sometimes it returns 4 or 5 decimal places but it doesn't go upto 6 decimal places even I use your example like fmt.Printf("%.8f\n", m.Lon())
. It shows 00 after the 6th for %.8f
.
I need Lat()/Lon() up to 8 decimal places, but it always returns 6 decimal places. How can I upgrade it to 8?