Boost C++ Libraries: Ticket #5776: program_options should understand "inf" and "nan" https://svn.boost.org/trac10/ticket/5776 <p> program_options does not accept NaN or Inf as valid double input. This problem seems like it will be fixed automatically when <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5689" title="#5689: Support Requests: lexical_cast must understand &#34;inf&#34; and &#34;nan&#34; (closed: fixed)">#5689</a> arrives in 1.48. I am setting the milestone accordingly. </p> <p> Recreate: the following sequence modifies the "Getting Started" first.cpp to accept double input: </p> <pre class="wiki"> cp $BOOST_SOURCE/libs/program_options/example/first.cpp . perl -pi -e 's/&lt;int&gt;/&lt;double&gt;/;' first.cpp LDFLAGS="-lboost_program_options" make first # ...or whatever </pre><p> The modified example indeed barfs on NaN or Inf input: </p> <pre class="wiki"> $ ./first --compression=5.5 Compression level was set to 5.5. $ ./first --compression=Inf error: in option 'compression': invalid option value 'Inf' $ ./first --compression=NaN error: in option 'compression': invalid option value 'NaN' </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5776 Trac 1.4.3 Vladimir Prus Sun, 08 Apr 2012 08:31:36 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/5776#comment:1 https://svn.boost.org/trac10/ticket/5776#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> This indeed appears to be fixed automatically due to lexical_cast fixes. The example in the issue works for me on SVN HEAD. </p> Ticket