title: How to convert int to bigint in golang?
body: <p>I'm trying to implement fast double Fibonacci algorithm as described <a href="https://www.nayuki.io/page/fast-fibonacci-algorithms" rel="noreferrer">here</a>:</p>
  <pre><code>// Fast doubling Fibonacci algorithm
  package main
  
  import &quot;fmt&quot;
  
  //  (Public) Returns F(n).
  func fibonacci(n int) int {
      if n &lt; 0 {
          panic(&quot;Negative arguments not implemented&quot;)
      }
      fst, _ := fib(n)
      return fst
  }
  
  // (Private) Returns the tuple (F(n), F(n+1)).
  func fib(n int) (int, int) {
      if n == 0 {
          return 0, 1
      }
      a, b := fib(n / 2)
      c := a * (b*2 - a)
      d := a*a + b*b
      if n%2 == 0 {
          return c, d
      } else {
          return d, c + d
      }
  }
  
  func main() {
      fmt.Println(fibonacci(13))
      fmt.Println(fibonacci(14))
  }
  </code></pre>
  <p>This works fine for small numbers; however, when the input number get larger, the program returns a wrong result. So I tried to use <code>bigInt</code> from <code>math/big</code> package:</p>
  <pre><code>// Fast doubling Fibonacci algorithm
  package main
  
  import (
      &quot;fmt&quot;
      &quot;math/big&quot;
  )
  
  //  (Public) Returns F(n).
  func fibonacci(n int) big.Int {
      if n &lt; 0 {
          panic(&quot;Negative arguments not implemented&quot;)
      }
      fst, _ := fib(n)
      return fst
  }
  
  // (Private) Returns the tuple (F(n), F(n+1)).
  func fib(n int) (big.Int, big.Int) {
      if n == 0 {
          return big.Int(0), big.Int(1)
      }
      a, b := fib(n / 2)
      c := a * (b*2 - a)
      d := a*a + b*b
      if n%2 == 0 {
          return c, d
      } else {
          return d, c + d
      }
  }
  
  func main() {
      fmt.Println(fibonacci(123))
      fmt.Println(fibonacci(124))
  }
  </code></pre>
  <p>However, go build complains that</p>
  <pre><code>cannot convert 0 (type int) to type big.Int
  </code></pre>
  <p>How to mitigate this problem?</p>