mathext

package
v2.0.0-...-8dcd6a7 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2015 License: BSD-2-Clause Imports: 1 Imported by: 0

Documentation

Overview

Package mathext contains extensions to the base Go math package.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbsInt

func AbsInt(x int) int

AbsInt returns the absolute value of the x integer.

Special cases are:

AbsInt(minInt) results in a panic (not representable)

func MaxBigInt

func MaxBigInt(x, y *big.Int) *big.Int

MaxBigInt returns the larger of x or y big integers.

Example
package main

import (
	"fmt"
	"math/big"

	"gopkg.in/karalabe/cookiejar.v2/exts/mathext"
)

func main() {
	// Define some sample big ints
	four := big.NewInt(4)
	five := big.NewInt(5)

	// Print the minimum and maximum of the two
	fmt.Println("Min:", mathext.MinBigInt(four, five))
	fmt.Println("Max:", mathext.MaxBigInt(four, five))

}
Output:

Min: 4
Max: 5

func MaxBigRat

func MaxBigRat(x, y *big.Rat) *big.Rat

MaxBigRat returns the larger of x or y big rationals.

func MaxInt

func MaxInt(x, y int) int

MaxInt returns the larger of x or y integers.

func MinBigInt

func MinBigInt(x, y *big.Int) *big.Int

MinBigInt returns the smaller of x or y big integers.

func MinBigRat

func MinBigRat(x, y *big.Rat) *big.Rat

MinBigRat returns the smaller of x or y big rationals.

func MinInt

func MinInt(x, y int) int

MinInt returns the smaller of x or y integers.

func SignFloat64

func SignFloat64(x int) int

SignFloat64 returns the sign of the x floating point number.

func SignInt

func SignInt(x int) int

SignInt returns the sign of the x integer.

Types

This section is empty.

Jump to

Keyboard shortcuts

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