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 from_fixed_decimal method to construct CompactDecimal #5879

Closed

Conversation

younies
Copy link
Member

@younies younies commented Dec 3, 2024

No description provided.

@younies younies requested a review from sffc as a code owner December 3, 2024 15:57
@younies younies changed the title Add from_fixed_decimal method to construct CompactDecimal from Signed… Add from_fixed_decimal method to construct CompactDecimal Dec 3, 2024
@younies younies requested a review from eggrobin December 3, 2024 16:08
/// #
/// assert_eq!(CompactDecimal::from_fixed_decimal(SignedFixedDecimal::from_str("+1.20").unwrap()), CompactDecimal::from_str("+1.20").unwrap());
/// ```
pub fn from_fixed_decimal(fixed_decimal: SignedFixedDecimal) -> Self {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: why do we want this function when we already have from_significand_and_exponent?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we do not need it.

I used format_fixed_decimal to format SignedFixedDecimal in the CompactFormatter.

See: #5456

@younies younies closed this Dec 3, 2024
@younies younies deleted the add-compact-number-from-fixeddecimal branch December 3, 2024 21:29
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.

2 participants