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 is_integer function #591

Merged
merged 1 commit into from
May 16, 2023
Merged

Implement is_integer function #591

merged 1 commit into from
May 16, 2023

Conversation

paupino
Copy link
Owner

@paupino paupino commented May 16, 2023

This is a simple implementation of is_integer for Decimal. This is intended to return true when the decimal is an integer without a fraction.

assert_eq!(dec!(5), dec!(5.00));
assert!(dec!(5).is_integer());
assert!(dec!(5.00).is_integer());
assert!(dec!(5.01).is_integer() == false);

Fixes #590

@paupino paupino enabled auto-merge (squash) May 16, 2023 03:11
@paupino paupino merged commit 2565a95 into master May 16, 2023
5 checks passed
@paupino paupino deleted the f/is_integer branch May 16, 2023 03:28
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.

Feature request: Decimal::is_integer()
1 participant