The highest tagged major version is
v2 .
Discover Packages
github.com/dastoikov/cool-lex-go
simplemath
package
Version:
v1.0.1
Opens a new window with list of versions in this module.
Published: Feb 17, 2025
License: Apache-2.0
Opens a new window with license information.
Imports: 2
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
Documentation
¶
Package simplemath offers simple/naive implementations of math operations for the purposes of aiding in writing auto tests.
Add returns the sum of a and b if no numeric overflow occurs, or an error otherwise.
Factorial returns the factorial of n, or 1 for n=0.
Error is reported if numeric overflow occurs.
Mul returns the product of a and b, or an error if numeric overflow occurs.
MulRange calculates the product of all integers within the inclusive interval [n1, n2] (or [n2, n1] if n2 < n1).
It returns the product if no numeric overflow occurs. Otherwise, it returns an error,
and the partial product calculated before the overflow is stored in 'r'.
NumComb calculates the number of combinations for the specified k and n.
n: number of elements to combine; n>=k must hold.
k: number of elements in a combination.
Error is reported if numeric overflow occurs.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.