Skip to content

zephyrtronium/expr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Basic expression evaluation using go/parser.

Implemented operations:

  • +x: nop
  • -x: arithmetic negate
  • ^x: bitwise not
  • x+y: sum
  • x-y: difference
  • x*y: product
  • x/y: quotient
  • x%y: remainder of division
  • x^y: bitwise exclusive or
  • x&y: bitwise and
  • x|y: bitwise inclusive or
  • x&^y: bit clear
  • x<<y: bitwise shift left
  • x>>y: bitwise (arithmetic) shift right
  • abs(x): absolute value
  • binomial(x, y): binomial coefficient (x choose y)
  • lb(x): position of highest set bit
  • pow(x, y[, m]): exponentiation base x of y, optionally mod m
  • gcd(x, y): greatest common denominator
  • modinv(x, y): multiplicative inverse of x in the group Z/yZ where y is assumed prime
  • factorial(x=1, y): y!/x!
  • rand(x=0, y): random number in [x, y)

About

Basic expression evaluation in Go using go/parser.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages