IDL 4.3 RTF Avatar
  1. OMG Issue

IDL43 — Setting Floating-point Literals to NaN and infinity not covered under the specification

  • Key: IDL43-91
  • Status: open  
  • Source: Ryan Friedman ( Ryan Friedman)
  • Summary:

    As a OMG IDL user, I have messages that treat NaN or infinity as a significant value. I would like to specify this as a default for a field.

    Currently, the OMG IDL specification says that a floating point value must include an integer part. It does not mention how to set or use special floating point values.

    Per IEEE-754, there are a few types of NaN. It would be desirable for OMG DDS IDL to interpret NaN as a quiet NaN, which matches C++ and Python.

    In ROS-IDL, it would look like this:
    float32 float32_nan NaN
    float64 float64_nan nan

    In ROS 2, I proposed an implementation that sets NaN. In the IDL generator, it creates the following IDL file, which is not supposedly valid according to the standard:

    module rosidl_generator_tests {
    module msg {
    module NanValueConstant_Constants

    { const float FLOAT32_NAN = nan; const double FLOAT64_NAN = nan; }

    ;
    struct NanValueConstant

    { uint8 structure_needs_at_least_one_member; }

    ;
    };
    };

    Can the specification be amended to support NaN, +inf, and -inf? This is blocking implementation in ROS 2.

  • Reported: IDL 4.2 — Tue, 5 Mar 2024 18:50 GMT
  • Updated: Tue, 11 Jun 2024 18:41 GMT