Skip to content
/ gofal Public

fractional api base on golang . golang math tools fractional molecular denominator 分数计算 分子 分母 运算

License

Notifications You must be signed in to change notification settings

xxjwxc/gofal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

7b4349a · Oct 8, 2019

History

30 Commits
Aug 28, 2019
Sep 23, 2019
Aug 6, 2019
Oct 8, 2019
Sep 21, 2019
Sep 21, 2019
Sep 21, 2019
Sep 21, 2019
Aug 5, 2019

Repository files navigation

Mentioned in Awesome Go

gofal

中文文档

  • 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

	tmp := fractional.Model(7, 12)
	tmp1 := fractional.Model(1, 12)
	fmt.Println(tmp.Add(tmp1))
  • out
2/3

2、 Subtraction

	tmp = fractional.Model(1, 4)
	tmp1 = fractional.Model(1, 3)
	fmt.Println(tmp.Sub(tmp1))
  • out
-1/12

3、Multiplication

	tmp = fractional.Model(3, 4)
	tmp1 = fractional.Model(2, 3)
	fmt.Println(tmp.Mul(tmp1))
  • out
1/2

4、 Division

	tmp = fractional.Model(3, 4)
	tmp1 = fractional.Model(2, 3)
	fmt.Println(tmp.Div(tmp1))
  • out
9/8

5、 out put (flat64)

    tmp = fractional.Model(1, 3)
	fmt.Println(tmp.Verdict())
  • out
0.3333333333333333

6、Chain expression

	tmp := fractional.Model(1, 3)
	tmp.Add(fractional.Model(1)).Mul(tmp)
	fmt.Println(tmp)
  • out
16/9
  • All functions can support chain expressions

About

fractional api base on golang . golang math tools fractional molecular denominator 分数计算 分子 分母 运算

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages