gitee.com/quant1x/gox@v1.7.6/num/type.go (about) 1 package num 2 3 import "math/big" 4 5 // Signed is a constraint that permits any signed integer type. 6 // If future releases of Go add new predeclared signed integer types, 7 // this constraint will be modified to include them. 8 type Signed interface { 9 ~int | ~int8 | ~int16 | ~int32 | ~int64 10 } 11 12 // Unsigned is a constraint that permits any unsigned integer type. 13 // If future releases of Go add new predeclared unsigned integer types, 14 // this constraint will be modified to include them. 15 type Unsigned interface { 16 ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr 17 } 18 19 // Integer is a constraint that permits any integer type. 20 // If future releases of Go add new predeclared integer types, 21 // this constraint will be modified to include them. 22 type Integer interface { 23 Signed | Unsigned 24 } 25 26 // Float is a constraint that permits any floating-point type. 27 // If future releases of Go add new predeclared floating-point types, 28 // this constraint will be modified to include them. 29 type Float interface { 30 ~float32 | ~float64 31 } 32 33 // Complex is a constraint that permits any complex numeric type. 34 // If future releases of Go add new predeclared complex numeric types, 35 // this constraint will be modified to include them. 36 type Complex interface { 37 ~complex64 | ~complex128 38 } 39 40 // Ordered is a constraint that permits any ordered type: any type 41 // that supports the operators < <= >= >. 42 // If future releases of Go add new ordered types, 43 // this constraint will be modified to include them. 44 type Ordered interface { 45 Integer | Float | ~string 46 } 47 48 // NumberOfCPUBitsRelated The number of CPU bits is related 49 // Deprecated: 不推荐使用 50 type NumberOfCPUBitsRelated interface { 51 ~int | ~uint | ~uintptr 52 } 53 54 // /*nil, */ int8, uint8, int16, uint16, int32, uint32, int64, uint64, int, uint, float32, float64 , bool, string 55 // ~int8 | ~uint8 | ~int16 | ~uint16 | ~int32 | ~uint32 | ~int64 | ~uint64 | ~int | ~uint | ~float32 | ~float64 | ~bool | ~string 56 // uintptr 57 58 // BaseType 基础类型 59 type BaseType interface { 60 Integer | Float | ~string | ~bool 61 } 62 63 // GenericType Series支持的所有类型 64 // Deprecated: 不推荐使用 65 type GenericType interface { 66 ~bool | ~int32 | ~int64 | ~int | ~float32 | ~float64 | ~string 67 } 68 69 // StatType 可以统计的类型 70 // Deprecated: 不推荐使用 71 type StatType interface { 72 ~int32 | ~int64 | ~float32 | ~float64 73 } 74 75 type BigFloat = big.Float // 预留将来可能扩展float 76 77 // Deprecated: 不推荐使用 78 type Number8 interface { 79 ~int8 | ~uint8 80 } 81 82 // Deprecated: 不推荐使用 83 type Number16 interface { 84 ~int16 | ~uint16 85 } 86 87 // Deprecated: 不推荐使用 88 type Number32 interface { 89 ~int32 | ~uint32 | float32 90 } 91 92 // Deprecated: 不推荐使用 93 type Number64 interface { 94 ~int64 | ~uint64 | float64 | int | uint 95 } 96 97 // Deprecated: 已弃用 98 type MoveType interface { 99 StatType | ~bool | ~string 100 } 101 102 // Number int和uint的长度取决于CPU是多少位 103 type Number interface { 104 Integer | Float 105 }