ix

package
v0.0.0-...-be83087 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2024 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package ix contains small integer arithmetic functions in the style of the standard `math` package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abs

func Abs[T signed](x T) T

Abs returns the absolute value of x.

func CeilDiv

func CeilDiv[T integer](a, b T) T

CeilDiv returns the result of the integer division a / b except rounded up (for nonnegative integers).

func GCD

func GCD[T integer](a, b T) T

GCD returns the greatest common divisor of the two arguments.

func LCM

func LCM[T integer](a, b T) T

LCM returns the least common multiple of the two arguments.

func Sign

func Sign[T signed](x T) T

Sign returns -1, 0 or 1 if x is less than, equal, or greater than zero, respectively.

func Sqrt

func Sqrt(y int) int

Sqrt returns the integer square root of y. For a nonnegative argument, it is the floor of the mathematical square root. Panics for negative numbers.

Types

This section is empty.

Jump to

Keyboard shortcuts

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