Uploaded image for project: 'Embedded Software & Tools'
  1. Embedded Software & Tools
  2. EXT_EP-11474

Request improvement in how floating point divide function in RTS handles division by 0

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: Low Low

      The core part of the floating point divide routine is in the RTS source file divf_i.h.  It contains these lines ...

      #ifndef Support_DENORM
        /*Checking if exponent == EMIN - 1, which if denormals are not supported
         *means checking if x is zero, if it is then return zero */
       if(real_x.exp == (uint32_t)(REAL_EMIN - 1)){
           quotient.mantissa = 0;
           quotient.exp = (uint32_t) -REAL_EXP_BIAS;
           quotient.sign = real_x.sign ^ real_y.sign;
           REALNUM_TO_REAL(quotient, left);
           return left;
        }
      #else
      #error This division routine does not support denormalized numbers
      #endif
      

      The code checks whether the dividend (the first number) is 0. If so, 0 of the correct sign is returned.

      The customer requests the addition of similar handling for the divisor (the second number). This is the code suggested:

        /*Checking if exponent == EMIN - 1, which if denormals are not supported
         *means checking if y is zero, if it is then return INF */
       if(real_y.exp == (uint32_t)(REAL_EMIN - 1)){
           quotient.exp      = REAL_EMAX + 1;
           quotient.mantissa = REAL_FIXED_POINT_ONE;
           quotient.sign = real_x.sign ^ real_y.sign;
           REALNUM_TO_REAL(quotient, left);
           return left;
        }
      

            syncuser TI User
            syncuser TI User
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: