Skip to content

Added DoubleAsStringWithPrecision function - Complex Arithmetics - #1883

Merged
César Zaragoza Cortés (cesarzc) merged 6 commits into
microsoft:mainfrom
devikamehra:devikamehra/doubleToString
Aug 28, 2024
Merged

César Zaragoza Cortés (cesarzc) merged 6 commits into
microsoft:mainfrom
devikamehra:devikamehra/doubleToString

Conversation

@devikamehra

@devikamehra Devika Mehra (devikamehra) commented Aug 25, 2024 •

Copy link
Copy Markdown
Contributor

Added DoubleAsStringWithPrecision function in Complex Arithmetics Kata

This is to address the issue #1788

@Manvi-Agrawal

Copy link
Copy Markdown
Contributor

It might be a good idea to rename the PR title here to include the Kata name. Seeing 2 PR with the same title is confusing. I really got confused by this title because I know JPark1023 worked on adding this function to QDK. Also, it might be helpful to add the link to GitHub issue created by Mariia(tcNickolas) for this.

@devikamehra Devika Mehra (devikamehra) changed the title Added DoubleAsStringWithPrecision function Added DoubleAsStringWithPrecision function - Complex Arithmetics Aug 25, 2024

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There is a way to reduce the scope of this change greatly and to make the code more readable. You're passing precision as an argument to the library code, so you have to define it in every task that uses the library. But the precision you use doesn't actually vary between the tasks, and the library not general-purpose but is limited to the needs of this one kata. You can instead hardcode precision within ComplexAsString and ComplexPolarAsString - this way you don't need to change any code outside the library!

Looking at the numbers involved, I don't think we need that much of precision too - none of them are smaller than 1, so 2-3 digits of precision should be plenty.

Thank you!

@devikamehra

Copy link
Copy Markdown
Contributor Author

There is a way to reduce the scope of this change greatly and to make the code more readable. You're passing precision as an argument to the library code, so you have to define it in every task that uses the library. But the precision you use doesn't actually vary between the tasks, and the library not general-purpose but is limited to the needs of this one kata. You can instead hardcode precision within ComplexAsString and ComplexPolarAsString - this way you don't need to change any code outside the library!

Looking at the numbers involved, I don't think we need that much of precision too - none of them are smaller than 1, so 2-3 digits of precision should be plenty.

Thank you!

Got it Mariia Mykhailova (@tcNickolas), I have updated the code with changes in only 3 files.

@tcNickolas

Copy link
Copy Markdown
Contributor

Can you please resolve conflicts in Common.qs? CI cannot run with them there

@devikamehra

Copy link
Copy Markdown
Contributor Author

Can you please resolve conflicts in Common.qs? CI cannot run with them there

Resolved

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Output looks good, just one suggestion on the resolved conflict.

Thank you!

Merged via the queue into microsoft:main with commit cf36843 Aug 28, 2024
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.

4 participants