Documentation ¶
Overview ¶
数值运算相关支持包
Index ¶
- Constants
- func Discount(price float64, discount uint8) float64
- func Divide(sum1, sum2 float64) float64
- func EarthDistance(lat1, lng1, lat2, lng2 float64) float64
- func EarthDistanceGps(a1, a2 *GPS) float64
- func Equally(money float64, len int) (float64, float64)
- func InArray(s any, arr any) bool
- func InDistance(p GPS, dic []GPS) bool
- func IsEqualFloat(f1, f2 any) bool
- func Price(v float64) float64
- func PriceHalf(v float64) float64
- func Regedit(c *Config)
- func RemoveByteArray(s byte, arr []byte) []byte
- func RemoveComplex128Array(s complex128, arr []complex128) []complex128
- func RemoveComplex64Array(s complex64, arr []complex64) []complex64
- func RemoveFloat32Array(s float32, arr []float32) []float32
- func RemoveFloat64Array(s float64, arr []float64) []float64
- func RemoveInt16Array(s int16, arr []int16) []int16
- func RemoveInt32Array(s int32, arr []int32) []int32
- func RemoveInt64Array(s int64, arr []int64) []int64
- func RemoveInt8Array(s int8, arr []int8) []int8
- func RemoveIntArray(s int, arr []int) []int
- func RemoveJsonNumberArray(s json.Number, arr []json.Number) []json.Number
- func RemoveRuneArray(s rune, arr []rune) []rune
- func RemoveStringArray(s string, arr []string) []string
- func RemoveUint16Array(s uint16, arr []uint16) []uint16
- func RemoveUint32Array(s uint32, arr []uint32) []uint32
- func RemoveUint64Array(s uint64, arr []uint64) []uint64
- func RemoveUint8Array(s uint8, arr []uint8) []uint8
- func RemoveUintArray(s uint, arr []uint) []uint
- func RemoveUintptrArray(s uintptr, arr []uintptr) []uintptr
- type Config
- type GPS
Constants ¶
View Source
const EARTH_RADIUS = 6378.137
地球半径大小 用于计算两个经纬度间的距离
View Source
const FLOAT_EQUAL_MIN = 0.0000001
浮点数比较相等时的最小值
因为浮点数的精度存在丢失问题,所以浮点数的相同不能比较绝对的相等,而应该是在某一范围内相同
所以此处的相同浮点数范围表示为 0.000,000,1
Variables ¶
This section is empty.
Functions ¶
func EarthDistance ¶
计算经纬度之间的距离【返回单位:m】 计算公式:C = sin(LatA*Pi/180)*sin(LatB*Pi/180) + cos(LatA*Pi/180)*cos(LatB*Pi/180)*cos((MLonA-MLonB)*Pi/180)
lat1 坐标点1的纬度 lng1 坐标点1的经度 lat1 坐标点2的纬度 lng2 坐标点2的经度
func InArray ¶ added in v0.1.29
判断s是否在arr数组中 PS: 类型不统一的话也会返回false,如s为int,但是arr不为[]int则也会返回false
s 待判断的变量,支持类型:bool,string,float64,float32,int,uint,int8,uint8,int16,uint16,int32,uint32,int64,uint64 arr 待判断的数组,需要对应s的类型,即s为string时arr为[]string
func InDistance ¶ added in v0.1.8
判断坐标点p是否在多边形dic区域内【坐标需要为统一坐标系坐标,即p和dic都是高德/百度/GPS等坐标】
p 要判断的坐标点 dic 多边形经纬度
func RemoveComplex128Array ¶ added in v0.2.1
func RemoveComplex128Array(s complex128, arr []complex128) []complex128
移除数组中的元素
s 待移除的变量 arr 待移除变量的数组
Types ¶
Click to show internal directories.
Click to hide internal directories.