title: 100 factorial in golang
body: <p>I want to calculate 100 factorial in golang. Here's the code I'm using.</p>
  
  <pre><code>var fact big.Int
  fact.MulRange(1, 100)
  </code></pre>
  
  <p>Printing output gives </p>
  
  <p><code>30414093201713378043612608166064768844377641568960512000000000000</code> </p>
  
  <p>But googling 100! gives <strong>9.332622e+157</strong>. I figured this is probably because of the datatype I am using (or maybe not). How do I solve it? Thanks in advance.</p>
  
  <p><strong>Edit:</strong> So I ran this code in go playground and it gave the correct answer. Is this due to a limitation on my PC? Plus when I convert it to string and iterate through it, it shows different numbers</p>
  
  <pre><code>str := fact.String()
  for _,val := range str{
      fmt.Print(val)
  }
  </code></pre>
  
  <p>Here is all the code</p>
  
  <pre><code>package main
  
  import (
      "fmt"
      "math/big"
  )
  
  func main() {
      var fact big.Int
      fact.MulRange(1, 100)
      fmt.Println(fact)
      n := fact.String()
      fmt.Println(n) //printing 100!
      sum := 0
      for _, i := range n {
          sum += int(i) //sum of each digits in 100!
      }
      fmt.Println(sum)
  }
  </code></pre>
  
  <p>and here is what go env shows:</p>
  
  <pre><code>set GOARCH=amd64
  set GOBIN=
  set GOCACHE=C:\Users\user\AppData\Local\go-build
  set GOEXE=.exe
  set GOHOSTARCH=amd64
  set GOHOSTOS=windows
  set GOOS=windows
  set GOPATH=C:\Users\user\go
  set GORACE=
  set GOROOT=C:\Go
  set GOTMPDIR=
  set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
  set GCCGO=gccgo
  set CC=gcc
  set CXX=g++
  set CGO_ENABLED=1
  set CGO_CFLAGS=-g -O2
  set CGO_CPPFLAGS=
  set CGO_CXXFLAGS=-g -O2
  set CGO_FFLAGS=-g -O2
  set CGO_LDFLAGS=-g -O2
  set PKG_CONFIG=pkg-config
  set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\user\AppData\Local\Temp\go-build839268890=/tmp/go-build -gno-record-gcc-switches
  </code></pre>
  
  <p>and go version : go version go1.10.1 windows/amd64</p>