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

Implement math/big evaluate operations #433

Open
vivlis opened this issue Jan 15, 2024 · 0 comments
Open

Implement math/big evaluate operations #433

vivlis opened this issue Jan 15, 2024 · 0 comments

Comments

@vivlis
Copy link

vivlis commented Jan 15, 2024

Hello,

I like this package, but I have problem with floating numbers as for data type float64 limitation, which for my case is rounding and unmarshaling from JSON.

Describe the solution you'd like
Would like to propose implementation math/big to standard evaluation (https://github.com/hyperjumptech/grule-rule-engine/blob/master/pkg/reflectmath.go).
it can be done with something similar like:
if left.Type().String() == "big.Float" && right.Type().String() == "big.Float" {
leftValue := left.Interface().(big.Float)
rightValue := right.Interface().(big.Float)
return reflect.ValueOf(leftValue.Cmp(&rightValue) == 1), nil
}

Describe alternatives you've considered
I've considered to create custom function with strings inputs, which will/is #working nicely, but I think above could be nice addition to package.

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

1 participant