fixed

package
v1.0.18 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package fixed provides types to work with fixed-point numbers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Int12_20

type Int12_20 uint32

Int12_20 is a signed 12.20 fixed-point number.

The integer part ranges from -2048 to 2047, inclusive. The fractional part has 20 bits of precision.

func I12_20

func I12_20(v int) Int12_20

I12_20 returns the integer value i as an Int12_20.

For example, passing the integer value 2 yields Int12_20(2097152).

func ParseInt12_20

func ParseInt12_20(s string) (Int12_20, error)

ParseInt12_20 converts the string s to a signed 12.20 fixed-point number.

func (Int12_20) Float64

func (x Int12_20) Float64() float64

func (Int12_20) String

func (x Int12_20) String() string

String returns a human-readable representation of a 12.20 fixed-point number.

type Int16_16

type Int16_16 uint32

Int16_16 is a signed 16.16 fixed-point number.

The integer part ranges from -32768 to 32767, inclusive. The fractional part has 20 bits of precision.

func I16_16

func I16_16(v int) Int16_16

I16_16 returns the integer value i as an Int16_16.

For example, passing the integer value 2 yields Int16_16(131072).

func ParseInt16_16

func ParseInt16_16(s string) (Int16_16, error)

ParseInt16_16 converts the string s to a signed 16.16 fixed-point number.

func (Int16_16) Float64

func (x Int16_16) Float64() float64

func (Int16_16) String

func (x Int16_16) String() string

String returns a human-readable representation of a 16.16 fixed-point number.

Jump to

Keyboard shortcuts

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