math

package
v0.0.0-...-80fb781 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: MIT, MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNumeric

func IsNumeric(s string) bool

IsNumeric quickly checks if string is a number. 12x faster then strconv.ParseFloat(s, 64)

func RoundTo

func RoundTo(n float64, decimals uint8) float64

RoundTo rounds `n` float to `decimals` number after comma

RoundTo(1.123, 1) = 1.1
RoundTo(1.655, 2) = 1.66

Types

type Number

type Number interface {
	constraints.Integer | constraints.Float
}

Jump to

Keyboard shortcuts

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