Program options default has unreasonable precision
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
Start by reproducing the formatting with the shown Boost.Program_options configuration and inspect how default_value formats a double for the displayed option description. Compare the behavior with ldecimal.cpp in the linked bezitopo project, while preserving the requested 0.1 form rather than .1. Done means the default is displayed as (=0.1) without breaking other option output.
Written by the indexing model from the issue text.
Description
Source code:
time_t now,then;
double tolerance,stageTolerance,areadone,rmsadj;
bool done=false;
string inputFile,outputFile;
bool validArgs,validCmd=true;
po::options_description generic("Options");
po::options_description hidden("Hidden options");
po::options_description cmdline_options;
po::positional_options_description p;
po::variables_map vm;
generic.add_options()
("tolerance,t",po::value<double>(&tolerance)->default_value(0.1),"Vertical tolerance")
("output,o",po::value<string>(&outputFile),"Output file");
hidden.add_options()
("input",po::value<string>(&inputFile),"Input file");
p.add("input",1);
cmdline_options.add(generic).add(hidden);
//...
cout<<generic;
Output:
-t [ --tolerance ] arg (=0.10000000000000001)
Vertical tolerance
-o [ --output ] arg Output file
Output should be:
-t [ --tolerance ] arg (=0.1) Vertical tolerance
-o [ --output ] arg Output file
I've tried this on Boost 1.65.1 on Ubuntu Beaver, and Boost 1.69.0 on DragonFly BSD 5.5, and got the same result.
For an idea on how to fix it, see ldecimal.cpp in https://github.com/phma/bezitopo, but that would output ".1", not "0.1".
- Dominant language
- C++
- Stars
- 136
- Forks
- 117
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from boostorg/program_options
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
boostorg/program_options#147 ·
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
boostorg/program_options#146 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
boostorg/program_options#144 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
boostorg/program_options#142 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 30/100
boostorg/program_options#139 ·
All issues in boostorg/program_options
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
AXERA-TECH/ax-llm#77 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
games-on-whales/wolf#509 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
bug-unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
NVIDIA/cuda-samples#453 ·