knumber

package
v0.5.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 18, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EqualF32

func EqualF32(a, b float32) bool

浮点数相等比较, 8位精度, 最大可以精确到6~7位

func EqualF64

func EqualF64(a, b float64) bool

浮点数相等比较, 8位精度, 最大可以精确到15~17位

func Round

func Round(val float64) int

野鸡四舍五入法

func ToFloat32

func ToFloat32(val any) (float32, bool)

any 数字类型 转 float32

func ToFloat64

func ToFloat64(val any) (float64, bool)

any 数字类型 转 float64

func ToInt

func ToInt(val any) (int, bool)

ToInt 将任意类型转换为int,转换失败返回0和false。

func ToInt8

func ToInt8(val any) (int8, bool)

ToInt8 将任意类型转换为int8,转换失败返回0和false。

func ToInt16

func ToInt16(val any) (int16, bool)

ToInt16 将任意类型转换为int16,转换失败返回0和false。

func ToInt32

func ToInt32(val any) (int32, bool)

ToInt32 将任意类型转换为int32,转换失败返回0和false。

func ToInt64

func ToInt64(val any) (int64, bool)

ToInt64 将任意类型转换为int64,转换失败返回0和false。

func ToUint

func ToUint(val any) (uint, bool)

ToUint 将任意类型转换为uint,转换失败返回0和false。

func ToUint8

func ToUint8(val any) (uint8, bool)

ToUint8 将任意类型转换为uint8,转换失败返回0和false。

func ToUint16

func ToUint16(val any) (uint16, bool)

ToUint16 将任意类型转换为uint16,转换失败返回0和false。

func ToUint32

func ToUint32(val any) (uint32, bool)

ToUint32 将任意类型转换为uint32,转换失败返回0和false。

func ToUint64

func ToUint64(val any) (uint64, bool)

ToUint64 将任意类型转换为uint64,转换失败返回0和false。

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL