Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more frequently used built-in variables like Zero #348

Open
Halimao opened this issue Feb 1, 2024 · 3 comments
Open

Add more frequently used built-in variables like Zero #348

Halimao opened this issue Feb 1, 2024 · 3 comments

Comments

@Halimao
Copy link

Halimao commented Feb 1, 2024

Can we add more frequently used built-in variables like

// Zero constant, to make computations faster.
// Zero should never be compared with == or != directly, please use decimal.Equal or decimal.Cmp instead.
var Zero = New(0, 1)

At lease add variables for following

var oneInt = big.NewInt(1)
var twoInt = big.NewInt(2)
var fourInt = big.NewInt(4)
var fiveInt = big.NewInt(5)
var tenInt = big.NewInt(10)
var twentyInt = big.NewInt(20)
// One constant, to make computations faster.
// One should never be compared with == or != directly, please use decimal.Equal or decimal.Cmp instead.
var One = New(1, 0)
// Two constant, to make computations faster.
// Two should never be compared with == or != directly, please use decimal.Equal or decimal.Cmp instead.
var Two = New(2, 0)
......
@SRNissen
Copy link

SRNissen commented Feb 2, 2024

Consider:

image

@Halimao
Copy link
Author

Halimao commented Feb 2, 2024

Consider:

image

I'm sorry, but what does this mean?

@mwoss
Copy link
Member

mwoss commented Feb 5, 2024

Hi @Halimao. Sure I will consider it :D Personally, I would opt for adding just essential constants, to not overload the API surface with unnecessary ones.

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

No branches or pull requests

3 participants