bits.Div64() Function in Golang with Examples Last Updated : 19 Apr, 2020 Comments Improve Suggest changes Like Article Like Report 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 Div64() function which is used to find the quotient and remainder of (a, b) divided by c, i.e., q = (a, b)/c, r = (a, b)%c with the dividend bits' upper half in parameter a and the lower half in parameter b. This function panics if c == 0 (division by zero) or c <= a (quotient overflow). To access Div64() function you need to add a math/bits package in your program with the help of the import keyword. Syntax: func Div64(a, b, c uint64) (q, r uint64) Parameters: This function takes three parameters of uint64 type, i.e., a, b, and c. Return Value: This function return two values of uint64 type, i.e., q and r. Here q is known as quotient and r is known as the remainder. Example 1: C // Golang program to illustrate bits.Div64() Function package main import ( "fmt" "math/bits" ) // Main function func main() { // Finding quotient and remainder // Using Div64() function q, r := bits.Div64(10, 12, 11) fmt.Println("Quotient:", q) fmt.Println("Remainder:", r) } Output: Quotient: 16769767339735956015 Remainder: 7 Example 2: C // Golang program to illustrate bits.Div64() Function package main import ( "fmt" "math/bits" ) // Main function func main() { // Finding quotient and remainder // Using Div64() function var a, b, c uint64 = 3, 10, 5 q, r := bits.Div64(a, b, c) fmt.Println("Number 1:", a) fmt.Println("Number 2:", b) fmt.Println("Number 3:", c) fmt.Println("Quotient:", q) fmt.Println("Remainder:", r) } Output: Number 1: 3 Number 2: 10 Number 3: 5 Quotient: 11068046444225730971 Remainder: 3 Comment More infoAdvertise with us Next Article bits.Div64() Function in Golang with Examples K Kirti_Mangal Follow Improve Article Tags : Go Language Golang-bits Similar Reads bits.Div() 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 Div() function which is used to find the quotient and remainder of (a, b) divided by c, i.e., q = (a, b)/ 2 min read bits.Div32() 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 Div32() function which is used to find the quotient and remainder of (a, b) divided by c, i.e., q = (a, b 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