Skip to content

adding helper functions, decimal numbers and sqrt#112

Open
kempeng wants to merge 6 commits intoshopspring:masterfrom
kempeng:master
Open

adding helper functions, decimal numbers and sqrt#112
kempeng wants to merge 6 commits intoshopspring:masterfrom
kempeng:master

Conversation

@kempeng
Copy link
Copy Markdown

@kempeng kempeng commented Aug 19, 2018

helper functions, predefined decimal numbers and added sqrt function

kempeng and others added 6 commits July 25, 2018 23:19
helpers.go defines several helper functions for the create of new decimal's from int's that make code using decimal a bit easier to read. Further more it implements a.Max() and a.Min() functions in the same fashion as other arithmetic functions like Add & Sub. (the decimal package already implements Max(d, d2....) and Min(), but these two helper functions are complementary to them.
Finally a.Float() is a convenience function for a.Float64() that ignore the precise bool, allowing inline use of the float conversion function
Zero.go defines convenience functions for testing decimal values with the zero value. These functions make code using decimal easier to read in my opinion. EqualZero() could be renamed into IsZero()
@kempeng
Copy link
Copy Markdown
Author

kempeng commented Sep 1, 2018

Can the files I submitted be added to the master?

@kempeng
Copy link
Copy Markdown
Author

kempeng commented Sep 13, 2018

can these files merged into the master?

Comment thread helpers.go
@bopjiang
Copy link
Copy Markdown

bopjiang commented Nov 7, 2018

func (d Decimal) SqrtRound(precision int32) (Decimal, bool) {
does not work when d < 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants