float64s

package
v0.0.0-...-0fadc07 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BitSize is the size in bits of this type.
	BitSize = 64
)

Variables

This section is empty.

Functions

func MapToSlice

func MapToSlice(m map[float64]struct{}) []float64

MapToSlice converts a map to slice.

func Parse

func Parse(v string) (float64, error)

Parse parses a string as base 10 float64.

func Ptr

func Ptr(v float64) *float64

Ptr returns a pointer to the value.

func PtrDefToNil

func PtrDefToNil(v float64, def float64) *float64

PtrDefToNil returns a pointer to the value, or nil if "def".

func PtrZeroToNil

func PtrZeroToNil(v float64) *float64

PtrZeroToNil returns a pointer to the value, or nil if 0.

func SafeIndex

func SafeIndex(s []float64, i int) float64

SafeIndex returns "s[i]" if possible, an 0 otherwise.

func SafeIndexPtr

func SafeIndexPtr(s []float64, i int) *float64

SafeIndexPtr returns "s[i]" if possible, an nil otherwise.

func SliceToMap

func SliceToMap(s []float64) map[float64]struct{}

SliceToMap converts a slice to map.

func SwapMap

func SwapMap(m map[float64]float64) (map[float64]float64, error)

SwapMap returns a copy of the map with keys and values swapped. Fails in case of duplicate values.

func Val

func Val(v *float64) float64

Val returns the pointer value, defaulting to zero if nil.

func ValDef

func ValDef(v *float64, def float64) float64

ValDef returns the pointer value, defaulting to "def" if nil.

Types

type Slice

type Slice []float64

Slice is a slice of values.

func (Slice) IsSorted

func (s Slice) IsSorted() bool

IsSorted returns true if the slice is sorted.

func (Slice) Len

func (s Slice) Len() int

Len implements the sort.Interface interface.

func (Slice) Less

func (s Slice) Less(i, j int) bool

Less implements the sort.Interface interface.

func (Slice) Sort

func (s Slice) Sort()

Sort the slice.

func (Slice) Swap

func (s Slice) Swap(i, j int)

Swap implements the sort.Interface interface.

Jump to

Keyboard shortcuts

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