Some concepts have names, and sometimes we care about those names, even (or especially) in our code.

At other times, we only care to distinguish one thing from the other. There are times when there’s no inherently meaningful value for a thing. For example, if we’re storing products in a database table we probably don’t want to store their category as a string. We don’t care how the categories are named, and besides, marketing changes the names all the time.

We care only that they’re distinct from each other.

const (
CategoryBooks = 0
CategoryHealth = 1
CategoryClothing = 2…

At times we would want to do mathematical operations which involves very big integer calculations that are outside the limit of all available primitive data types. For example factorial of 100 contains 158 digits in it so we can’t store it in any primitive data type available. Golang doesn’t check for overflows implicitly and so this may lead to unexpected results when a number larger than 64 bits are stored in a int64.

To solve this problem, Go provides the Package “big” which implements arbitrary-precision arithmetic (big numbers).


The following numeric types are supported:

Int    signed integers

Bala subramaniyan

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store