summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/av-elier/go-decimal-to-rational/README.md
diff options
context:
space:
mode:
authorBenau <Benau@users.noreply.github.com>2021-08-25 04:32:50 +0800
committerGitHub <noreply@github.com>2021-08-24 22:32:50 +0200
commit53cafa9f3d0c8be33821fc7338b1da97e91d9cc6 (patch)
tree964a225219099a1a1c282e27913767da588191b4 /vendor/github.com/av-elier/go-decimal-to-rational/README.md
parentd4195deb3a6305c49c50ff30e8af978c7f1bdd92 (diff)
downloadmatterbridge-msglm-53cafa9f3d0c8be33821fc7338b1da97e91d9cc6.tar.gz
matterbridge-msglm-53cafa9f3d0c8be33821fc7338b1da97e91d9cc6.tar.bz2
matterbridge-msglm-53cafa9f3d0c8be33821fc7338b1da97e91d9cc6.zip
Convert .tgs with go libraries (and cgo) (telegram) (#1569)
This commit adds support for go/cgo tgs conversion when building with the -tags `cgo` The default binaries are still "pure" go and uses the old way of converting. * Move lottie_convert.py conversion code to its own file * Add optional libtgsconverter * Update vendor * Apply suggestions from code review * Update bridge/helper/libtgsconverter.go Co-authored-by: Wim <wim@42.be>
Diffstat (limited to 'vendor/github.com/av-elier/go-decimal-to-rational/README.md')
-rw-r--r--vendor/github.com/av-elier/go-decimal-to-rational/README.md54
1 files changed, 54 insertions, 0 deletions
diff --git a/vendor/github.com/av-elier/go-decimal-to-rational/README.md b/vendor/github.com/av-elier/go-decimal-to-rational/README.md
new file mode 100644
index 00000000..6a5abe92
--- /dev/null
+++ b/vendor/github.com/av-elier/go-decimal-to-rational/README.md
@@ -0,0 +1,54 @@
+# go-decimal-to-rational
+
+[![Build Status](https://travis-ci.org/av-elier/go-decimal-to-rational.svg?branch=master)](https://travis-ci.org/av-elier/go-decimal-to-rational)
+
+Go library to convert decimal (float64) to rational fraction with required precision
+
+Relies on [Continued Fraction](http://mathworld.wolfram.com/ContinuedFraction.html) algorythm.
+
+It's sometimes more appropriate than default big.Rat SetString, because
+you can get `2/3` from `0.6666` by specifiing required precision. In big.Rat SetString
+you can only get `3333/50000`, and have no way to manipulate than (as of go 1.11).
+
+# Example
+```go
+func ExampleNewRatP() {
+ fmt.Println(NewRatP(0.6666, 0.01).String())
+ fmt.Println(NewRatP(0.981, 0.001).String())
+ fmt.Println(NewRatP(0.75, 0.01).String())
+ // Output:
+ // 2/3
+ // 981/1000
+ // 3/4
+}
+```
+```go
+func ExampleNewRatI() {
+ fmt.Println(NewRatI(0.6667, 3).String())
+ fmt.Println(NewRatI(0.6667, 4).String())
+ // Output:
+ // 2/3
+ // 6667/10000
+}
+```
+
+# Docs
+```
+import dectofrac "github.com/av-elier/go-decimal-to-rational"
+```
+
+#### func NewRatI
+
+```go
+func NewRatI(val float64, iterations int64) *big.Rat
+```
+NewRatI returns rational from decimal using `iterations` number of
+iterations in Continued Fraction algorythm
+
+#### func NewRatP
+
+```go
+func NewRatP(val float64, stepPrecision float64) *big.Rat
+```
+NewRatP returns rational from decimal by going as mush iterations, until
+next fraction is less than `stepPrecision`