This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMDS243GPEVM: Processor specific alternative to "isnan()"

Part Number: TMDS243GPEVM

Hi,

I am interested in finding the best means of determining whether a value is NaN on the am243x processor. 

What I have seen so far:

- The "isnan()" function: I have seen this defined in some windows related packages/headers, but I am looking for a less generic, more processor-specific alternative.

- Comparing a value against itself: if not true, then NaN is assumed. Perhaps this is a viable option.

What is the recommended means to determine if a value is NaN on this processor?

Kind regards,

Jeff

  • Hi Jeff,

    I'm unaware of an special method for detecting NaN on R5F or M4F.

    I don't see any special treatment for NaN in MCU+SDK, except for in the benchmark demo where NaN is detected using an explicit comparison against 0x7FC00000. Please see <SDK>\examples\motor_control\benchmark_demo\common\math_helper.c:arm_snr_f32().

    Looking through the TI-CLANG math.h, it seems NaN for single- and double-precision floats is detected by checking for the IEEE NaN bit encoding.

    I'm looping in some colleagues for more feedback on this topic.

    Regards,
    Frank

  • Hi Frank,

    Yes, I see the 0x7FC00000 NaN representation you mention -- is this a better means of detecting NaN than comparing a value to itself, which is also observed in the SDK (<SDK>\source\kernel\nortos\dpl\common\printf.c:_etoa)? 

    Where can I view the TI-CLANG math.h file you mention?

    Thanks for the help,

    Jeff