Why long long not supported

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Why long long not supported

538 Views
rahulkrishna
Contributor IV

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?

Labels (1)
3 Replies

396 Views
rayhall
Contributor V

Rahul,

This may help you. Float Cast Causing Link Error

Ray.

396 Views
rahulkrishna
Contributor IV

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.

0 Kudos

396 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

this depends on how many floating computation you used in your project.

for example, if use “32bit/IEEE32 for the HC12"

pastedImage_0.png

In CW for hcs12x, long long type is 32bit by default.

if you use

volatile long long a=123,b=123, c;

    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!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos