decimal icon indicating copy to clipboard operation
decimal copied to clipboard

Arbitrary-precision fixed-point decimal numbers in Go

Results 162 decimal issues
Sort by recently updated
recently updated
newest added

if i have an table on RDBMS and i need to query it and map to struct looks like this ```go type Data struct { A decimal.Decimal B decimal.Decimal C...

Fixed documentation on StringFixedBank, which incorrectly called `StringFixed` instead of `StringFixedBank` in the documentation. I also noticed that the documented output for `decimal.NewFromFloat(545).StringFixedBank(-1)` is 550, but the actual output is...

This seems super usefull. Basically allows user to set how many numbers after decimal to return(and rounds up). Using `StringFixed`. Thanks!

helper functions, predefined decimal numbers and added sqrt function

This PR implements - normalizing (removing trailing zeros) - rounding to significant figures (https://en.wikipedia.org/wiki/Significant_figures)

Some benchmarks results are inaccurate due to timing issues. This PR fixes some of these issues.

Very simple, mostly cosmetic change. It is cleaner to use integer operations rather than floating point in integer context.

The culprit is here, around line 207: ``` if exp2 == 0 { // specials if mant == 0 { return Decimal{} //

Includes GetBSON and SetBSON methods and a unit test comparing String outputs of decimals before and after being marshalled and unmarshalled via struct and map. Uses string parsing to convert...