Documentation
¶
Index ¶
- func AbsI64(val int64) int64
- func ClampI64(val, minVal, maxVal int64) int64
- func FormatFloat64(num float64) string
- func MaxI(lhs, rhs int) int
- func MaxI32(lhs, rhs int32) int32
- func MaxI64(lhs, rhs int64) int64
- func MinI(lhs, rhs int) int
- func MinI32(lhs, rhs int32) int32
- func MinI64(lhs, rhs int64) int64
- func RoundF(num float64, precision uint) float64
- func RoundI(num float64) int
- func ToFixed(num float64, precision uint) float64
- func WithinPlatform(value, defValue int64) int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatFloat64 ¶
Format a float.
If the float is NaN or infinite, then those are explicitly returned.
func RoundF ¶
Rounds num to the given number of decimal places and returns the result as a float64, using math.Round for IEEE-754 compliant rounding.
func RoundI ¶
Rounds a 64-bit floating point number to the nearest integer, returning it as an int. Values halfway between integers are rounded away from zero.
func ToFixed ¶
Rounds num to the given number of decimal places and returns the result as a float64. Unlike RoundF, it uses integer rounding logic (via RoundI), which may behave slightly differently around half-values.
func WithinPlatform ¶
Ensure that the given value is within the limit of the platform-specific integer type and, if it is, multiply it by two.
If the value would be larger than the platform integer, then the default value in `defValue` is returned.
If `defValue` is too large, then the maximum integer size for the platform is returned.
Types ¶
This section is empty.