package mathutil
import "github.com/teamwork/utils/mathutil"
Index ¶
- func DivideCeil(count int64, pageSize int64) int64
- func IsSignedZero(f float64) bool
- func Limit(v, lower, upper float64) float64
- func Max(a, b int64) int64
- func Min(a, b int64) int64
- func Round(f float64) float64
- func RoundPlus(f float64, precision int) float64
- type Byte
Functions ¶
func DivideCeil ¶
DivideCeil divides two integers and rounds up, rather than down (which is what happens when you do int64/int64).
func IsSignedZero ¶
IsSignedZero checks if this number is a signed zero (i.e. -0, instead of +0).
func Limit ¶
Limit a value between a lower and upper limit.
func Max ¶
Max gets the highest of two numbers.
func Min ¶
Min gets the lowest of two numbers.
func Round ¶
Round will round the value to the nearest natural number.
.5 will be rounded up.
func RoundPlus ¶
RoundPlus will round the value to the given precision.
e.g. RoundPlus(7.258, 2) will return 7.26
Types ¶
type Byte ¶
type Byte float64
Byte is a float64 where the String() method prints out a human-redable description.
func (Byte) HumanReadable ¶
HumanReadable will take a measurement multiple as well as a slice of formats to convert the byte into a human readable format using the given parameters.
func (Byte) String ¶
String will return the bytes formatted as "mebibytes" (multiples of 1024)
func (Byte) StringAsBytes ¶
StringAsBytes will return the bytes formatted as "bytes" (multiples of 1000)
Source Files ¶
- Version
- v1.0.0 (latest)
- Published
- Mar 14, 2022
- Platform
- linux/amd64
- Imports
- 2 packages
- Last checked
- 5 hours ago –
Tools for package owners.