package
Version:
v2.0.0-...-db694ce
Opens a new window with list of versions in this module.
Published: Oct 14, 2017
License: BSD-3-Clause
Opens a new window with license information.
Imports: 5
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
Package checked implements basic checked arithmetic.
-
func Add(x, y int64) (sum int64, ok bool)
-
func Add32(x, y int32) (sum int32, ok bool)
-
func Int32(x int64) (int32, bool)
-
func Mul(x, y int64) (prod int64, ok bool)
-
func Mul32(x, y int32) (prod int32, ok bool)
-
func MulBigPow10(x *big.Int, n int32) *big.Int
-
func MulPow10(x int64, n int32) (p int64, ok bool)
-
func Sub(x, y int64) (diff int64, ok bool)
-
func Sub32(x, y int32) (diff int32, ok bool)
-
func SubSum(x, y, z int32) (res int32, ok bool)
-
func SumSub(x, y, z int32) (res int32, ok bool)
Add returns x + y and a bool indicating whether the addition was successful.
Add32 returns x + y and a bool indicating whether the addition was
successful.
Int32 returns true if x can fit in an int32.
Mul returns x * y and a bool indicating whether the multiplication was
successful.
Mul returns x * y and a bool indicating whether the multiplication was
successful.
MulBigPow10 computes 10 * x ** n.
It reuses x.
MulPow10 computes 10 * x ** n and a bool indicating whether the
multiplcation was successful.
Sub returns x - y and a bool indicating whether the subtraction was successful.
Sub32 returns x - y and a bool indicating whether the subtraction was
successful.
SubSum returns x - y + z and a bool indicating whether the operations were
successful.
SumSub returns x + y - z and a bool indicating whether the operations were
successful.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.