go Remainder()

Remainder()方法语法

func Remainder(x, y float64) float64

go源码对Remainder()方法的介绍:

Remainder returns the IEEE 754 floating-point remainder of x/y.

Special cases are:

Remainder(±Inf, y) = NaN
Remainder(NaN, y) = NaN
Remainder(x, 0) = NaN
Remainder(x, ±Inf) = x
Remainder(x, NaN) = NaN

golang标准库的math.Remainder()方法,可以返回IEEE 754差数求值,即将参数x减去最接近x/y的一个整数值与y的乘积。除此之外,Remainder(±Inf, y) = NaN;Remainder(NaN, y) = NaN;Remainder(x, 0) = NaN;Remainder(x, ±Inf) = x;Remainder(x, NaN) = NaN。


math.Remainder()方法实例代码

func main() {
	remainder_num := math.Remainder(6, 3)
	fmt.Println(remainder_num)
}

运行go文件,得到输出:

0

全栈后端 / go语法 :













Copyright © 2022-2024 笨鸟工具 x1y1z1.com All Rights Reserved.