Hi,
i wanted to do floating point calculations but since in my project floating point calculations are not allowed i was trying to do integer calculations. In order to get values up to 5 digits after the decimal i was doing all the calculations with a multiplication factor of 10000000. Now my doubt to make this kind of huge calculations i wanted to use long long values, but the compiler does not seem to support. Can someone please help me to understand. And also if i include floating point calculations will be code size increases considerably?
Thank you very much but i want to know how much does the code size increase, since if do very few calculations is it worth adding the floating point library.
this depends on how many floating computation you used in your project.
for example, if use “32bit/IEEE32 for the HC12"
In CW for hcs12x, long long type is 32bit by default.
if you use
c=a*b; |
c=a*b takes 60+ bytes code.
if use:
volatile float a=123,b=123, c; |
c=a*b;
here c=a*b takes 260+ bytes code.
if use:
volatile int a=1234,b=1234, c;
c=a+b;
here, c=a+b takes 13 bytes code.
can this help you?
Have a great day,
Zhang Jun
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------