Skip to content

Support `nan` in application parameters

Luc Hermitte requested to merge lhermitte/otb:GetParameterFloat-Nan into develop


Fixes #2305 (closed) : Improper management of NaN in GetParameterFloat()


GetParameterFloat("somefloatparameter") will return 3.40282e+38 (std::numeric_limit<float>::max()) instead of nan when an OTB application is executed with -somefloatparameter NaN.

Implementation Details

Instead of the improper

m_Value = (value < m_MinimumValue) ? m_MinimumValue : (value < m_MaximumValue) ? value : m_MaximumValue;

uses otb::clamp that has the same behaviour as C++17 std::clamp


The copyright owner is CNES and has signed the ORFEO ToolBox Contributor License Agreement.

Check before merging:

  • All discussions are resolved
  • At least 2 👍 votes from core developers, no 👎 vote.
  • The feature branch is (reasonably) up-to-date with the base branch
  • Dashboard is green
  • Copyright owner has signed the ORFEO ToolBox Contributor License Agreement
  • Optionally, run git diff develop... -U0 --no-color | -p1 -i on latest changes and commit

Merge request reports