Programming Language: Golang

Namespace/Package Name: math/big

Class/Type: Int

Method/Function: Rsh

Examples at hotexamples.com: 30

The math/big package in Go provides arbitrary-precision integers and floating-point numbers. The Rsh method in the big.Int type is used to perform right-shift operations on big integers.

Here are some examples of using Rsh:

**Example 1:**

This code initializes a big integer with a value of 16, and then performs a right shift operation on it by 2 bits using the Rsh method. The output will be:

**Example 2:**

This code initializes a big integer with a value of 1000, and then performs a right shift operation on it by 5 bits using the Rsh method. The output will be:

Here are some examples of using Rsh:

package main import ( "fmt" "math/big" ) func main() { num := big.NewInt(16) fmt.Printf("Original value: %v\n", num) // Shift right by 2 bits num.Rsh(num, 2) fmt.Printf("New value: %v\n", num) }

This code initializes a big integer with a value of 16, and then performs a right shift operation on it by 2 bits using the Rsh method. The output will be:

Original value: 16 New value: 4

package main import ( "fmt" "math/big" ) func main() { num := big.NewInt(1000) fmt.Printf("Original value: %v\n", num) // Shift right by 5 bits num.Rsh(num, 5) fmt.Printf("New value: %v\n", num) }

This code initializes a big integer with a value of 1000, and then performs a right shift operation on it by 5 bits using the Rsh method. The output will be:

Original value: 1000 New value: 31The package library for these examples is "math/big".

Frequently Used Methods

Frequently Used Methods

Frequently Used Methods

Related in langs

Frequently Used Methods

Related