Answers Database
V1.5, V1.4 COREGEN: Does COREGen support floating point values in the .COE coefficient files?
Record #3498
Product Family: Software
Product Line: Coregen
Product Part: Coregen
Problem Title:
V1.5, V1.4 COREGEN: Does COREGen support floating point values in the .COE coefficient
files?
Problem Description:
Urgency: standard
General Description:
Can you use floating point or fixed point decimals in
coefficient files, and do any of the CORE Generator modules
support floating point arithmetic in general?
Solution 1:
COREGen modules currently do not support floating point
arithmetic. However, in many cases such support is not
absolutely necessary, as there is a way to emulate "floating
point" arithmetic if you have a known, fixed limit of
precision that you need to support.
1) Say A and B are used in a calculation, and both A and B
are 16-bit floating point numbers ranging in value from 0
to 1. Your first impulse might be to believe that there is a
need to do floating point arithmetic.
However, the fact that a number falls between 0 and 1 does not
mean it has to be represented as floating point. The only
advantage floating point has is that it allows you to trade a
large DYNAMIC RANGE for PRECISION in your application.
This is because you are usually limited in the number of
bits that you can use to represent your coefficient values.
If you are restricted to 16 bits to represent your values, if
you choose to represent it as a floating point number, the 16
bit floating point number must use some bits for precision (in
the Mantissa) and some bits for the Exponent. As a result,
you cannot get both maximum range and precision at the same
time.
However, if you know what the smallest value that needs to be
represented is, you can represent ALL of your values using
fixed point integers and do your calculations using fixed
point arithmetic. The results of all calculations are then
simply scaled to restore the fractional representation.
Example: a 16 bit integer could represent all values from
0 to 1 in steps of 1/65536. Using this conversion, all
processing logic need only work in whole numbers.
End of Record #3498 - Last Modified: 01/13/00 13:04 |