math

package
v0.0.0-...-ed3284d Latest Latest
Warning

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

Go to latest
Published: May 3, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

* @Author: NorthCity1984 * @LastEditTime: 2022-05-03 18:50:22 * @Description: * @Website: https://grimoire.cn * Copyright (c) NorthCity1984 All rights reserved.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func A

func A(n, m int) int

排列数: A(3,1)=3

func Abs

func Abs[T Number](num T) T

返回num的绝对值

func C

func C(n, m int) int

组合数:C(3, 2)=3

func Exp2

func Exp2(num int) int64

返回 2**n

func Max

func Max[T Number](arg T, args ...T) T

返回n个数中的最小值

func Min

func Min[T Number](arg T, args ...T) T

返回n个数中的最大值

func Sqrt

func Sqrt(x float64) float64

返回x的平方根,精度比原生略低

func Sum

func Sum[T Number](args ...T) (sum T)

返回n个数的和

Types

type Number

type Number interface {
	int | int32 | int64 | float32 | float64
}

Jump to

Keyboard shortcuts

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