checked

package
v2.0.0-...-db694ce Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2017 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package checked implements basic checked arithmetic.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(x, y int64) (sum int64, ok bool)

Add returns x + y and a bool indicating whether the addition was successful.

func Add32

func Add32(x, y int32) (sum int32, ok bool)

Add32 returns x + y and a bool indicating whether the addition was successful.

func Int32

func Int32(x int64) (int32, bool)

Int32 returns true if x can fit in an int32.

func Mul

func Mul(x, y int64) (prod int64, ok bool)

Mul returns x * y and a bool indicating whether the multiplication was successful.

func Mul32

func Mul32(x, y int32) (prod int32, ok bool)

Mul returns x * y and a bool indicating whether the multiplication was successful.

func MulBigPow10

func MulBigPow10(x *big.Int, n int32) *big.Int

MulBigPow10 computes 10 * x ** n. It reuses x.

func MulPow10

func MulPow10(x int64, n int32) (p int64, ok bool)

MulPow10 computes 10 * x ** n and a bool indicating whether the multiplcation was successful.

func Sub

func Sub(x, y int64) (diff int64, ok bool)

Sub returns x - y and a bool indicating whether the subtraction was successful.

func Sub32

func Sub32(x, y int32) (diff int32, ok bool)

Sub32 returns x - y and a bool indicating whether the subtraction was successful.

func SubSum

func SubSum(x, y, z int32) (res int32, ok bool)

SubSum returns x - y + z and a bool indicating whether the operations were successful.

func SumSub

func SumSub(x, y, z int32) (res int32, ok bool)

SumSub returns x + y - z and a bool indicating whether the operations were successful.

Types

This section is empty.

Jump to

Keyboard shortcuts

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