Martin Coria

Floating point with CW for Coldfire v4.0.2.4 and MCF5272

Discussion created by Martin Coria on May 30, 2007
Latest reply on May 31, 2007 by CompilerGuru
Hello, I'm using Codewarrior for Coldfire v4.0.2.4, targeting a MCF5272. My project is set to perform software floating point operations. I have a function that returns a float as follows:

float GetProcessorPeriodF() {
  float fPeriod=0;
  fPeriod = (float) 1 / 48;
  fPeriod *= 1000;
  return (float) fPeriod;

The function produces the right float number (20.83) but when it returns, the float variable that gets the value looks like this:
(fTest = GetProcessorPeriodF() fTest = 1.101442e+09

I don't know what's going on. I'll appreciate your help. Thank you, Martin

J2MEJediMaster added CW version and MCU type to header, cleaned up code

Message Edited by J2MEJediMaster on 2007-05-30 09:34 AM