Arduino Forum

Using Arduino => Programming Questions => Topic started by: Bebbetufs on Feb 28, 2011, 03:41 pm

Title: Data type int and long, anything in between?
Post by: Bebbetufs on Feb 28, 2011, 03:41 pm
I'm just curious if there is a data type besides long which can hold more than an int. I need to hold a large number, but long seems like overkill.
Title: Re: Data type int and long, anything in between?
Post by: AWOL on Feb 28, 2011, 03:42 pm
No.
Have you tried "unsigned int" (0..65535)?
Title: Re: Data type int and long, anything in between?
Post by: Bebbetufs on Feb 28, 2011, 03:50 pm
Yep.
I though maybe I could specify a double int or something. :)
Title: Re: Data type int and long, anything in between?
Post by: AWOL on Feb 28, 2011, 04:02 pm
Quote
I though maybe I could specify a double int or something

A "double int" would be a long.
Title: Re: Data type int and long, anything in between?
Post by: robtillaart on Feb 28, 2011, 04:21 pm
What are the minimum and maxiumum value you want to store?
Title: Re: Data type int and long, anything in between?
Post by: Bebbetufs on Feb 28, 2011, 06:52 pm
Maximum 150 000
Minimum 0
Title: Re: Data type int and long, anything in between?
Post by: Nishant_Sood on Feb 28, 2011, 06:59 pm
not in between and an int!
Title: Re: Data type int and long, anything in between?
Post by: davekw7x on Feb 28, 2011, 08:34 pm
...I need to hold a large number, but long seems like overkill.


Quote from: Bebbetufs

...double int...



With the Arduino compiler, avr-gcc, an int occupies two bytes and a long occupies four bytes.  There is no built-in data type that occupies more than two bytes and fewer than four bytes.  Period.  Full stop.


Regards,

Dave
Title: Re: Data type int and long, anything in between?
Post by: Bebbetufs on Feb 28, 2011, 08:36 pm
Ok thanks for being so clear.

B