Programming Language: Golang

Namespace/Package Name: math/big

Class/Type: Int

Method/Function: Lsh

Examples at hotexamples.com: 30

The `math/big` package library in Go provides operations on big integers that do not have a predefined size limit. One of the functions provided in this package library is the `Int.Lsh()` function which shifts a given integer's bits to the left by a specified amount.

Here is an example code snippet demonstrating the usage of `Int.Lsh()`:

Here is an example code snippet demonstrating the usage of `Int.Lsh()`:

import ( "fmt" "math/big" ) func main() { x := big.NewInt(256) y := x.Lsh(x, 2) fmt.Println(y) }In this example, we create a new `big.Int` variable `x` initialized with a value of 256. We then call the `Lsh()` function on `x` and pass in the same variable as the first argument and the number 2 as the second argument. This will shift `x`'s bits to the left by 2 positions (equivalent to multiplying by 2^2) and store the result in a new `big.Int` variable `y`. We then print out the value of `y`, which should be 1024. Overall, the package library `math/big` provides operations on big integers that are not limited by a fixed size limit, making it ideal for working with large numbers in Go.

Frequently Used Methods

Frequently Used Methods

Frequently Used Methods

Related in langs

Frequently Used Methods

Related