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.

MSP432P401R: Issues with Qmath

Part Number: MSP432P401R

In MSP430® IQmathLib Users Guide version 01.10.00.05, for _QNatan2, A is the Y coordinate input value in Q format, and B is the X coordinate input value in Q format.

But for _QNatan2PU, A is the X coordinate input value in Q format, and B is the Y coordinate input value in Q format.

Why the inconsistency?

Also, I noticed that _QNlog(_Q(0.0)) = 0.  That seems odd to me; since _QNlog(_Q(1.0)) = 0, I would expect _QNlog(_Q(0.0)) to saturate to the maximum negative value.  

Agreed?

  • Hi Shawn,
    I have reached out to the library author for comment.

    Regards,
    Chris
  • Hi Shawn,

    The inconsistency in _Qatan2() and _Qatan2PU() parameters is a known documentation issue, the actual implementation is always Y, X and the results match that. I have a open bug that will be fixed in the next release however I cannot give an estimate on when that might be.

    With regards to your question on _Qlog(0) the result is undefined but we don't have special values for undefined/NaN and +/- infinity like in floating point. I see your point, it probably makes more sense to return MAX_Q_NEG instead of zero since log(N) approaches -INF which would saturate to the maximum negative value. I'll think about how this should be handled and possibly look at establishing a better convention for handling of such cases (divide by zero is another). It would also be worthwhile adding a section to the users guide that explains the handling and specific scenarios that result in MAX_Q_NEG, 0 and MAX_Q_POS results.

    Regards,

    Brent

  • Thank you for your response.

    I am using the log function in a control application, and having a monotonic response is important to me.  As it stands, I will need to add exception code to handle small input values.

**Attention** This is a public forum