Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xxjwxc/gofal
fractional api base on golang . golang math tools fractional molecular denominator 分数计算 分子 分母 运算
https://github.com/xxjwxc/gofal
denominator fractional math molecular operation
Last synced: 26 days ago
JSON representation
fractional api base on golang . golang math tools fractional molecular denominator 分数计算 分子 分母 运算
- Host: GitHub
- URL: https://github.com/xxjwxc/gofal
- Owner: xxjwxc
- License: mit
- Created: 2019-08-05T07:37:55.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-10-08T03:02:59.000Z (about 5 years ago)
- Last Synced: 2024-07-31T20:48:16.656Z (3 months ago)
- Topics: denominator, fractional, math, molecular, operation
- Language: Go
- Homepage:
- Size: 40 KB
- Stars: 18
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-go - gofal - fractional api for Go. (Data Structures and Algorithms / Miscellaneous Data Structures and Algorithms)
- awesome-go - gofal - fractional api for Go. (Data Structures and Algorithms / Miscellaneous Data Structures and Algorithms)
- awesome-go-extra - gofal - 08-05T07:37:55Z|2019-10-08T03:02:59Z| (Generators / Miscellaneous Data Structures and Algorithms)
README
[![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go)
# gofal
[中文文档](README_zh_cn.md)
- Fractional Operational Correlation API base on golang
- Supporting Precision Operations
- Supporting addition, subtraction, multiplication and division
- Support chain expression
- Support result output(flat64)### Example
1、 Add
```go
tmp := fractional.Model(7, 12)
tmp1 := fractional.Model(1, 12)
fmt.Println(tmp.Add(tmp1))
```- out
```sh
2/3
```2、 Subtraction
```go
tmp = fractional.Model(1, 4)
tmp1 = fractional.Model(1, 3)
fmt.Println(tmp.Sub(tmp1))
```- out
```sh
-1/12
```3、Multiplication
```go
tmp = fractional.Model(3, 4)
tmp1 = fractional.Model(2, 3)
fmt.Println(tmp.Mul(tmp1))
```- out
```sh
1/2
```4、 Division
```go
tmp = fractional.Model(3, 4)
tmp1 = fractional.Model(2, 3)
fmt.Println(tmp.Div(tmp1))
```- out
```sh
9/8
```5、 out put (flat64)
```go
tmp = fractional.Model(1, 3)
fmt.Println(tmp.Verdict())
```- out
```sh
0.3333333333333333
```6、Chain expression
```go
tmp := fractional.Model(1, 3)
tmp.Add(fractional.Model(1)).Mul(tmp)
fmt.Println(tmp)
```- out
```sh
16/9
```
- All functions can support chain expressions