mathutil

package
v1.3.9 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2023 License: MIT Imports: 4 Imported by: 1

Documentation

Overview

Package mathutil implements some functions for math calculation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AngleToRadian added in v1.3.8

func AngleToRadian(angle float64) float64

AngleToRadian converts angle value to radian value.

func Cos added in v1.3.9

func Cos(radian float64, precision ...int) float64

Cos returns the cosine of the radian argument.

func Exponent

func Exponent(x, n int64) int64

Exponent calculate x^n

func Factorial

func Factorial(x uint) uint

Factorial calculate x!

func Fibonacci

func Fibonacci(first, second, n int) int

Fibonacci calculate fibonacci number before n

func GCD added in v1.3.9

func GCD(integers ...int) int

GCD return greatest common divisor (GCD) of integers.

func IsPrime added in v1.3.8

func IsPrime(n int) bool

IsPrimes checks if number is prime number.

func LCM added in v1.3.9

func LCM(integers ...int) int

LCM return Least Common Multiple (LCM) of integers.

func Percent

func Percent(val, total float64, n int) float64

Percent calculate the percentage of val to total

func PointDistance added in v1.3.8

func PointDistance(x1, y1, x2, y2 float64) float64

PointDistance get two points distance.

func RadianToAngle added in v1.3.8

func RadianToAngle(radian float64) float64

RadianToAngle converts radian value to angle value.

func RoundToFloat

func RoundToFloat(x float64, n int) float64

RoundToFloat round up to n decimal places

func RoundToString

func RoundToString(x float64, n int) string

RoundToString round up to n decimal places

func Sin added in v1.3.9

func Sin(radian float64, precision ...int) float64

Cos returns the sine of the radian argument.

func TruncRound

func TruncRound(x float64, n int) float64

TruncRound round off n decimal places

Types

This section is empty.

Jump to

Keyboard shortcuts

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