The following gives the incorrect answer for lfp which should be 0x004E47AE but i get a trucated 0x000047AE. If I change the declaration of "long lfp" to "volatile long lfp" it gives me the correct answer. Clue: with the original declaration lfp is assigned to a register, with the volatile it get stored in memory.
float z, f, fp; int eb; long lfp;
z = log(setpoint) / log(2); eb = (int)z + 0x7F; f = setpoint / 16; fp = (f-1) * 8388608; // 2 << 23 lfp = (long)(fp);
Is this a bug?
I am using CCS v5.1.0.09000, MSP430 Compiler Tools v4.0.0, optimization is set to 0
Thank you, Don
All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.
TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs andembedded processors, along with software, tools and the industry’s largest sales/support staff.