[Icc-avr] Saving floating point constants in flash

John Baraclough j_baraclough at zetnet.co.uk
Fri Aug 15 11:27:27 PDT 2008


As the previous post, define the values as a Flash constants and then 
access them by label.

__flash float Thirteen = 13.0;
__flash float Seven = 7.0;

y = ((float)Thirteen * x) + Seven;

All the best for now,
John
 

bobgardner at aol.com wrote:
> Consider 'assigning' an integer to an fp var like x=3; or using 
> integer numbers in an fp expression like y=13x+7;
> I notice that the compiler loads the int and calls int2fp. I assume 
> loading the float constants from flash must surely be faster than 
> calling a subroutine, so adding a decimal point in that expression 
> like this y=13.0*x+7.0; should load the fp numbers from flash. If I 
> use a number like 13.0 several times, does the compiler keep track of 
> all the fp constants and reuse them when possible? Trying to squeeze 
> 10 lbs of stuff into a 5lb bag.....
> ------------------------------------------------------------------------
> It's time to go back to school! Get the latest trends and gadgets that 
> make the grade on AOL Shopping 
> <http://shopping.aol.com/back-to-school?ncid=aolins00050000000007>.
> ------------------------------------------------------------------------
>
> _______________________________________________
> Icc-avr mailing list
> Icc-avr at imagecraft.com
> http://dragonsgate.net/mailman/listinfo/icc-avr
>   



More information about the Icc-avr mailing list