func New(main int, fractional int, code, symbol, funame string, fushare uint) (*Currency, error) {
	if fushare == 0 {
		return nil, ErrInvalidFUS
	}
	if main != 0 && fractional < 0 {
		fractional = -fractional
	}
	fus := int(fushare)
	m := main + (fractional / fus)
	f := fractional % fus
	fudigits := digits(fus - 1)
	mag := float64(5.0)
	for i := 0; i < fudigits-1; i++ {
		mag /= 10
	}
	return &Currency{
		Code:       code,
		Symbol:     symbol,
		Main:       m,
		Fractional: f,
		FUName:     funame,
		FUShare:    fushare,
		fuDigits:   fudigits,
		magnitude:  mag,
	}, nil
}
New returns a new instance of currency.
package currency
import (
	"errors"
	"math"
	"regexp"
	"strconv"
	"strings"
)
var (
	ErrMismatchCurrency = errors.New("currencies do not match")
	ErrInvalidCurrency = errors.New("invalid currency value provided")
	ErrInvalidFUS = errors.New("invalid functional unit share provided")
)
var replacer = regexp.MustCompile(`([^0-9.\-\+])`)
const (
	replaceWith = ""
)
type Currency struct {
	Code string `json:"code,omitempty"`
	Symbol string `json:"symbol,omitempty"`
	Main int `json:"main,omitempty"`
	Fractional int `json:"fractional,omitempty"`
	FUName string `json:"fuName,omitempty"`
	FUShare uint `json:"fuShare,omitempty"`
	fuDigits int `json:"fuDigits,omitempty"`
	magnitude float64 `json:"magnitude,omitempty"`
}