microsoft / microsoft/qdk

Use M.Q.Convert.DoubleAsStringWithPrecision to trim Doubles printed in the katas

Open
#1,788 2 comments 0 reactions 0 assignees View on GitHub
good first issue katas
Dominant language
Rust
Stars
1k
Forks
212
Avg merge
3d 8h
Merged PRs (30d)
65

Description

Follow-up to #1406: now that the function M.Q.Convert.DoubleAsStringWithPrecision is available, we can use it in the katas to shorten the long floating-point numbers.

Here are a few examples of the katas that print long doubles:

* Complex Arithmetic
![image](https://github.com/user-attachments/assets/eca560de-4ecd-47ac-9be4-f5b3e008ab57)
* Single-Qubit Gates kata, task "Prepare Arbitrary State"
* Preparing Quantum States, task "Unequal Superposition"

There are probably others; the typical scenario in which this occurs is printing the Double parameters of the test or returns of the solution for an incorrect solution. We are unlikely to need more than 2-3 digits of precision in these cases.

Contributor guide

Open the contributing guide

Research direction

Read M.Q.Convert.DoubleAsStringWithPrecision, then inspect the Complex Arithmetic, Single-Qubit Gates, and Preparing Quantum States katas for output that includes Double values. Run the affected kata checks and confirm incorrect-solution messages display shortened values with roughly 2–3 digits of precision.

Written by the indexing model from the issue text.

Assessment

Domain
quantum-computing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.