bits.Mul() Function in Golang with Examples Last Updated : 28 Apr, 2020 Comments Improve Suggest changes Like Article Like Report bits.Mul() Function in Golang is used to find the full-width product of x and y. The execution time of this function does not depend on the inputs. To access this function, one needs to imports the math/bits package in the program. Syntax: func Mul(x, y uint) (hi, lo uint) Parameters: This function takes two parameter of uint type, i.e., x, y. Note: (hi, lo) = x * y Here, hi is the product bits' upper half and, lo is the lower half returned. Return Value: This function returns the full-width product of x and y. Example 1: C // Golang program to illustrate // bits.Mul() Function package main import ( "fmt" "math/bits" ) // Main function func main() { // Using Mul() function hi, lo := bits.Mul(5, 10) fmt.Println("Full-width product of x and y : ", hi, lo) } Output: Full-width product of x and y : 0 50 Example 2: C // Golang program to illustrate // bits.Mul() Function package main import ( "fmt" "math/bits" ) // Main function func main() { // Using Mul() function const a, b = 34, 56 hi, lo := bits.Mul(a, b) fmt.Println("Number 1:", a) fmt.Println("Number 2:", b) fmt.Println("Upper half:", hi) fmt.Println("Lower half:", lo) } Output: Number 1: 34 Number 2: 56 Upper half: 0 Lower half: 1904 Comment More infoAdvertise with us Next Article bits.Mul() Function in Golang with Examples S SHUBHAMSINGH10 Follow Improve Article Tags : Go Language Golang-bits Similar Reads bits.Mul32() Function in Golang with Examples bits.Mul32() Function in Golang is used to find the 64-bit product of x and y. The execution time of this function does not depend on the inputs. To access this function, one needs to imports the math/bits package in the program. Syntax: func Mul32(x, y uint32) (hi, lo uint32) Parameters: This funct 2 min read bits.Mul64() Function in Golang with Examples bits.Mul64() Function in Golang is used to find the 128-bit product of x and y. The execution time of this function does not depend on the inputs. To access this function, one needs to imports the math/bits package in the program. Syntax: func Mul64(x, y uint64) (hi, lo uint64) Parameters: This func 2 min read bits.Len() Function in Golang with Examples Go language provides inbuilt support for bits to implement bit counting and manipulation functions for the predeclared unsigned integer types with the help of bits package. This package provides Len() function which is used to find the minimum number of bits required to represent a and the result is 2 min read bits.Rem() Function in Golang with Examples Go language provides inbuilt support for bits to implement bit counting and manipulation functions for the predeclared unsigned integer types with the help of bits package. This package provides Rem() function which is used to find the remainder of (h, l) divided by a. This function will panics if a 2 min read bits.Sub() Function in Golang with Examples The bits.Sub() Function in Golang is used to find the difference of a, b and borrow, i.e. diff = a - b - borrow. Here the borrow must be 0 or 1; otherwise, the behavior is undefined. To access this function, one needs to imports the math/bits package in the program. The return value of the borrowOut 2 min read Like