Documentation ¶
Overview ¶
Go (golang) library implementing rational complex numbers. BigCは実部、虚部が共に有理数であるような複素数を扱うためのパッケージです。 リポジトリは https://github.com/mathlava/bigc です。
Example ¶
package main import ( "fmt" "github.com/mathlava/bigc" ) func main() { ex, _ := bigc.ParseString("(1+2i)/(3-4i)") fmt.Println(ex.String()) }
Output: -1/5+2i/5
Index ¶
- type BigC
- func (x *BigC) AbsSq() *big.Rat
- func (z *BigC) Add(x *BigC, y *BigC) *BigC
- func (z *BigC) Conj(x *BigC) *BigC
- func (z *BigC) Equal(x *BigC) bool
- func (x *BigC) FloatString(prec int) string
- func (x *BigC) Imag() *big.Rat
- func (z *BigC) Inv(x *BigC) *BigC
- func (x *BigC) IsPureImag() bool
- func (x *BigC) IsReal() bool
- func (z *BigC) Mul(x *BigC, y *BigC) *BigC
- func (z *BigC) Neg(x *BigC) *BigC
- func (z *BigC) Quo(x *BigC, y *BigC) *BigC
- func (x *BigC) Real() *big.Rat
- func (z *BigC) Set(x *BigC) *BigC
- func (x *BigC) String() string
- func (z *BigC) Sub(x *BigC, y *BigC) *BigC
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BigC ¶
type BigC struct {
// contains filtered or unexported fields
}
A BigC object represents a rational complex number. BigCは複素数を表します
func ParseString ¶
ParseString returns a new BigC instance of the result of the expression expr. Arithmetic operations and parentheses are supported.
func (*BigC) FloatString ¶
FloatString returns a string representation of x in decimal form with prec digits of precision after the radix point. The last digit is rounded to nearest, with halves rounded away from zero.
func (*BigC) Imag ¶
Imag returns the imaginary-part of x. The result is a reference to x's imaginary-part; it may change if a new value is assigned to x, and vice versa.
func (*BigC) IsPureImag ¶
IsPureImag reports whether whether x is a pure imaginary number.
func (*BigC) Real ¶
Real returns the real-part of x. The result is a reference to x's real-part; it may change if a new value is assigned to x, and vice versa.