sint

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2018 License: Apache-2.0 Imports: 0 Imported by: 68

Documentation

Overview

Package sint is a basic math library for int.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abs

func Abs(a int) int

func AlignUp

func AlignUp(v int, alignment int) int

func Byte

func Byte(i int) byte

func Clamp

func Clamp(x, min, max int) int

func Log10

func Log10(i int) int

Log10 returns the log10(i), rounded down to a whole integer. i must be positive.

Example
package main

import (
	"fmt"

	"github.com/google/gapid/core/math/sint"
)

func main() {
	for _, n := range []int{0, 1, 2, 9, 10, 11, 99, 100, 101} {
		fmt.Printf("Log10(%v): %v\n", n, sint.Log10(n))
	}
}
Output:

Log10(0): 0
Log10(1): 0
Log10(2): 0
Log10(9): 0
Log10(10): 1
Log10(11): 1
Log10(99): 1
Log10(100): 2
Log10(101): 2

func Max

func Max(a, b int) int

Max returns the maximum value of a and b.

func MaxOf

func MaxOf(a int, b ...int) int

MaxOf returns the maximum value of all the arguments.

func Min

func Min(a, b int) int

Min returns the minimum value of a and b.

func MinOf

func MinOf(a int, b ...int) int

MinOf returns the minimum value of all the arguments.

Types

This section is empty.

Jump to

Keyboard shortcuts

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