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.

TMS320F28335: Floating point division - minimum divisor

Part Number: TMS320F28335


Hi,

A rogue static analysis warning about divide by zero has started a conversation about floating point division, and I don't know the answer - "What is the minimum divisor on a 28335 which won't cause a divide by zero error?"

(Also, where should I have looked to find this?  I read through spraan9a, but either missed it, or it's not in there..)

Thanks in advance,

Simon

  • Hi Simon,

    The smallest acceptable divisor is the smallest number in the "normal" range of floating point numbers, i.e., 1.0*2^-126 (in IEEE754, biased exponent format you would represent this as 1.0*2^1). Anything between +-1.0*2^-126, not including zero, is a denorm (or subnormal) number (+-0.nnn...*2^-127). In the c2000 devices with hardware FPUs we treat denorms as 0, so you get a divide by zero error when you use them as divisors.

    If you try to do c/(a-b) and 'a' and 'b' are close enough to result in a denorm result, it results in an underflow, and the subsequent division of c/(denorm) is equivalent to a divide by 0, and you then get infinity as the result, and an overflow.