Source File
math.go
Belonging Package
oss.terrastruct.com/d2/lib/geo
package geoimportfunc (, , , float64) float64 {if == {return math.Abs( - )} else if == {return math.Abs( - )} else {return math.Sqrt((-)*(-) + (-)*(-))}}// compare a and b and consider them equal if// difference is less than precision e (e.g. e=0.001)func (, , float64) int {if math.Abs(-) < {return 0}if < {return -1}return 1}// TruncateDecimals truncates floats to keep up to 3 digits after decimal, to avoid issues with floats on different machines.// Since we're not launching rockets, 3 decimals is enough precision for what we're doingfunc ( float64) float64 {return float64(int(*1000)) / 1000}func ( float64) int {if < 0 {return -1}if > 0 {return 1}return 0}
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |