go-inf / inf Goto Github PK
View Code? Open in Web Editor NEWPackage inf (type inf.Dec) implements "infinite-precision" decimal arithmetic.
Home Page: https://godoc.org/gopkg.in/inf.v0
License: Other
Package inf (type inf.Dec) implements "infinite-precision" decimal arithmetic.
Home Page: https://godoc.org/gopkg.in/inf.v0
License: Other
see title, I think it's useful, thank u.
The below code produces a panic. This is happening because the scale passed is math.MinInt32. When quoRem
(dec.go:311) tries to call exp10(-shift)
, it panics. Here shift
is math.MinInt32
, and when it takes the negative value of that, it ends up still with math.MinInt32
because of two's complement (see https://play.golang.org/p/9H2UtAurI7).
package main
import (
"fmt"
"math"
inf "gopkg.in/inf.v0"
)
func main() {
z := new(inf.Dec)
x := inf.NewDec(1, 0)
y := inf.NewDec(1, 0)
z.QuoRound(x, y, math.MinInt32, inf.RoundHalfUp)
fmt.Println(z)
}
Panics with:
panic: runtime error: index out of range
goroutine 1 [running]:
panic(0x4a91a0, 0xc42000a150)
/usr/local/go/src/runtime/panic.go:500 +0x1a1
gopkg.in/inf%2ev0.exp10(0x80000000, 0x0)
/go/src/gopkg.in/inf.v0/dec.go:393 +0x52
gopkg.in/inf%2ev0.(*Dec).quoRem(0xc420013020, 0xc420012f60, 0xc420012fc0, 0x180000000, 0xc42000eb00, 0xc42000eb20, 0x482186, 0x4a1260, 0x1)
/go/src/gopkg.in/inf.v0/dec.go:311 +0x595
gopkg.in/inf%2ev0.(*Dec).quo(0xc420012f30, 0xc420012f60, 0xc420012fc0, 0x51a1e0, 0xc42000a2f4, 0x51a560, 0xc42000a3c0, 0x1)
/go/src/gopkg.in/inf.v0/dec.go:264 +0x12b
gopkg.in/inf%2ev0.(*Dec).QuoRound(0xc420012f30, 0xc420012f60, 0xc420012fc0, 0x80000000, 0x51a560, 0xc42000a3c0, 0x0)
/go/src/gopkg.in/inf.v0/dec.go:257 +0xa1
main.main()
/go/src/gopkg.in/m.go:14 +0xb1
exit status 2
(shamelessly channelling @onlyjob from google/go-tspi#6 (comment))
Please consider assigning version numbers and tagging releases. Tags/releases
are quite useful for downstream package maintainers (in Debian and other distributions) to export source tarballs, automatically track new releases and to declare dependencies between packages. Read more in the Debian Upstream Guide.
Thank you.
See also
c7d99f8 does not pass unit tests with Go 1.10. At least:
+ GOPATH=/builddir/build/BUILD/inf-c7d99f84517584483b3d800924f7468c411de442/_build:/usr/share/gocode
+ go test -buildmode pie -compiler gc -ldflags '-extldflags '\''-Wl,-z,relro '\'''
# gopkg.in/inf.v0_test
./rounder_example_test.go:34: Println arg list ends with redundant newline
FAIL gopkg.in/inf.v0 [build failed]
The README.md needs a clarification so we aren't lost in almost-self-reference hell. The initial page for this REPO reads,
Package inf (type inf.Dec) implements "infinite-precision" decimal arithmetic. https://godoc.org/gopkg.in/inf.v0
but the package is called inf
not inf.v0
inside go-inf
not gopkg.in
. It seems like this package is NOT what people want. It seems like we need to go to https://gopkg.in/inf.v0 and following the link to https://github.com/go-inf/inf/tree/v0.9.1. But if you build this code it still imports "gopkg.in/inf.v0
so it won't build anyway.
What is the point of all this nonsense? Where is the code that satisfies:
package inf_test
import (
"math/big"
"testing"
"gopkg.in/inf.v0"
)
inside say inf/rounder_test.go
? Are we supposed to clone https://github.com/go-inf/inf/tree/v0.9.1
and put it into src tree as .../src/gopkg.in/inf.v0
Why break the mold as this isn't how all other packages work?
if it is EOL, do any other recommendations?
Just like in the similar issue go-gcfg/gcfg#1
ambiguity of LICENSE
scope may become a problem for packaging and distributing of this module in Debian. We've just had another package with similar problem rejected... Please advise.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.