nyamath

package module
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2018 License: MIT Imports: 4 Imported by: 0

README

nyamath

This repository holds a package including some functions for mathmatics.

Download / Install

The easiest way to install is to run go get -u github.com/catsworld/nyamath. You can also manually git clone the repository to $GOPATH/src/catsworld/nyamath.

Documentation

Overview

Package nyamath includes some functions for mathmatics.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Calculate added in v1.1.1

func Calculate(x int64, operator string, y int64) (int64, error)

Calculate returns the result of calculating x and y with the operator.

func CalculateU added in v1.1.1

func CalculateU(unary string, x int64) (int64, error)

CalculateU returns the result of calculating a with the unary.

func IsNumber

func IsNumber(r rune) bool

IsNumber checks if a rune is in ['0'..'9']

func IsUnary added in v1.1.1

func IsUnary(operator string) bool

IsUnary checks if the operator is an unary.

func Priority added in v1.1.1

func Priority(operator string) int

Priority returns the priority of the operator.

func Qpow

func Qpow(x, y int64) int64

Qpow calculates x^y and returns the result with the quick pow algorithm.

func Valid added in v1.1.1

func Valid(operator string) bool

Valid checks if the operator is a valid operator.

Types

type Expression added in v1.1.1

type Expression struct {
	// contains filtered or unexported fields
}

Expression stores the infix, sufix and result of a math expression.

func New added in v1.1.1

func New(s string) (Expression, error)

New generates a expression from the string s.

func (Expression) Result added in v1.1.1

func (e Expression) Result() int64

Result returns the result of the expression e.

Jump to

Keyboard shortcuts

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