func (x Currency) Sqrt() (c Currency) {
	f, _ := new(big.Rat).SetInt(&x.i).Float64()
	sqrt := new(big.Rat).SetFloat64(math.Sqrt(f))
	c.i.Div(sqrt.Num(), sqrt.Denom())
	return
}
Sqrt returns a new Currency value y = sqrt(c). Result is rounded down to the
nearest integer.
package types
import (
	"errors"
	"math"
	"math/big"
	"github.com/NebulousLabs/Sia/build"
)
type (
	Currency struct {
		i big.Int
	}
)
var (
	ErrNegativeCurrency = errors.New("negative currency not allowed")
	ErrUint64Overflow = errors.New("cannot return the uint64 of this currency - result is an overflow")
	ZeroCurrency = NewCurrency64(0)
)
func NewCurrency(b *big.Int) (c Currency) {
	if b.Sign() < 0 {
		build.Critical(ErrNegativeCurrency)
	} else {
		c.i = *b
	}
	return
}
func NewCurrency64(x uint64) (c Currency) {
	c.i.SetUint64(x)
	return
}
func (x Currency) Add(y Currency) (c Currency) {
	c.i.Add(&x.i, &y.i)
	return
}
func (x Currency) Big() *big.Int {
	return new(big.Int).Set(&x.i)
}
func (x Currency) Cmp(y Currency) int {
	return x.i.Cmp(&y.i)
}
func (x Currency) Cmp64(y uint64) int {
	return x.Cmp(NewCurrency64(y))
}
func (x Currency) Div(y Currency) (c Currency) {
	c.i.Div(&x.i, &y.i)
	return
}
func (x Currency) Div64(y uint64) (c Currency) {
	c.i.Div(&x.i, new(big.Int).SetUint64(y))
	return
}
func (x Currency) Equals(y Currency) bool {
	return x.Cmp(y) == 0
}
func (x Currency) Equals64(y uint64) bool {
	return x.Cmp64(y) == 0
}
func (x Currency) Mul(y Currency) (c Currency) {
	c.i.Mul(&x.i, &y.i)
	return
}
func (x Currency) Mul64(y uint64) (c Currency) {
	c.i.Mul(&x.i, new(big.Int).SetUint64(y))
	return
}
func (x Currency) MulFloat(y float64) (c Currency) {
	if y < 0 {
		build.Critical(ErrNegativeCurrency)
	} else {
		cRat := new(big.Rat).Mul(
			new(big.Rat).SetInt(&x.i),
			new(big.Rat).SetFloat64(y),
		)
		c.i.Div(cRat.Num(), cRat.Denom())
	}
	return
}
func (x Currency) MulRat(y *big.Rat) (c Currency) {
	if y.Sign() < 0 {
		build.Critical(ErrNegativeCurrency)
	} else {
		c.i.Mul(&x.i, y.Num())
		c.i.Div(&c.i, y.Denom())
	}
	return
}
func (x Currency) MulTax() (c Currency) {
	c.i.Mul(&x.i, big.NewInt(39))
	c.i.Div(&c.i, big.NewInt(1000))
	return c
}
func (x Currency) RoundDown(y Currency) (c Currency) {
	diff := new(big.Int).Mod(&x.i, &y.i)
	c.i.Sub(&x.i, diff)
	return
}
func (x Currency) IsZero() bool {
	return x.i.Sign() <= 0
}