base10quant

package module
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2025 License: MIT Imports: 1 Imported by: 0

README

base10 encoding of primitive types

$ go test -bench=. -benchmem . 
goos: darwin
goarch: arm64
pkg: github.com/ndx-technologies/base10quant
cpu: Apple M3 Max
BenchmarkL9/string-16           93159283                12.71 ns/op           16 B/op          1 allocs/op
BenchmarkL9/from_string-16      149476885                8.018 ns/op           0 B/op          0 allocs/op
PASS
ok      github.com/ndx-technologies/base10quant 3.436s

Documentation

Index

Examples

Constants

View Source
const (
	MaxL9 = 999_999_999
	MinL9 = 0
)

Variables

View Source
var ErrL9InvalidFormat = errors.New("l9: invalid format")

Functions

This section is empty.

Types

type L9

type L9 struct {
	// contains filtered or unexported fields
}

L9 is base10 chars encoding least significant 9 decimals of uint32.

Example
package main

import (
	"fmt"

	"github.com/ndx-technologies/base10quant"
)

func main() {
	var v base10quant.L9
	v.UnmarshalText([]byte("123456789"))
	fmt.Println(v)
}
Output:

123456789

func L9FromString

func L9FromString(s string) (L9, error)

func L9FromUint32

func L9FromUint32(v uint32) L9

func (L9) AppendText added in v0.1.1

func (s L9) AppendText(b []byte) ([]byte, error)

func (L9) IsZero added in v0.1.2

func (s L9) IsZero() bool

func (L9) MarshalText

func (s L9) MarshalText() ([]byte, error)

func (L9) String

func (s L9) String() string

func (L9) UInt32

func (s L9) UInt32() uint32

func (*L9) UnmarshalText

func (s *L9) UnmarshalText(b []byte) error

Jump to

Keyboard shortcuts

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