units

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package units provides functions for converting different units of IOTAs.

Index

Constants

View Source
const (
	// I is the smallest Unit.
	I = Unit(1)
	// Ki = Kiloiota. 1000 iotas.
	Ki = Unit(1000)
	// Mi = Megaiota. 1 million iotas.
	Mi = Unit(1000000)
	// Gi = Gigaiota. 1 billion iotas.
	Gi = Unit(1000000000)
	// Ti = Teraiota. 1 trillion iotas.
	Ti = Unit(1000000000000)
	// Pi = Petaiota. 1 quadrillion iotas.
	Pi = Unit(1000000000000000)
)

Variables

This section is empty.

Functions

func ConvertUnits

func ConvertUnits(val float64, from Unit, to Unit) float64

ConvertUnits converts the given value in the base Unit to the given new Unit.

func ConvertUnitsString

func ConvertUnitsString(val string, from Unit, to Unit) (float64, error)

ConvertUnitsString converts the given string value in the base Unit to the given new Unit.

Types

type Unit

type Unit float64

Unit a unit of IOTAs.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL