func (a Amount) String() string {
	return a.Format(AmountSOTER)
}
String is the equivalent of calling Format with AmountSOTER.
package soterutil
import (
	"errors"
	"math"
	"strconv"
)
type AmountUnit int
const (
	AmountMegaSOTER  AmountUnit = 6
	AmountKiloSOTER  AmountUnit = 3
	AmountSOTER      AmountUnit = 0
	AmountMilliSOTER AmountUnit = -3
	AmountMicroSOTER AmountUnit = -6
	AmountNanoSoter  AmountUnit = -9
)
func (u AmountUnit) String() string {
	switch u {
	case AmountMegaSOTER:
		return "MSOTER"
	case AmountKiloSOTER:
		return "kSOTER"
	case AmountSOTER:
		return "SOTER"
	case AmountMilliSOTER:
		return "mSOTER"
	case AmountMicroSOTER:
		return "μSOTER"
	case AmountNanoSoter:
		return "nSoter"
	default:
		return "1e" + strconv.FormatInt(int64(u), 10) + " SOTER"
	}
}
type Amount int64
func round(f float64) Amount {
	if f < 0 {
		return Amount(f - 0.5)
	}
	return Amount(f + 0.5)
}
func NewAmount(f float64) (Amount, error) {
	switch {
	case math.IsNaN(f):
		fallthrough
	case math.IsInf(f, 1):
		fallthrough
	case math.IsInf(f, -1):
		return 0, errors.New("invalid soter amount")
	}
	return round(f * NanoSoterPerSoter), nil
}
func (a Amount) ToUnit(u AmountUnit) float64 {
	return float64(a) / math.Pow10(int(u+9))
}
func (a Amount) ToSOTER() float64 {
	return a.ToUnit(AmountSOTER)
}
func (a Amount) Format(u AmountUnit) string {
	units := " " + u.String()
	return strconv.FormatFloat(a.ToUnit(u), 'f', -int(u+9), 64) + units
}