 # Dividing a long by 10, what happends to the remainer?

Simple question;

long a=12345; long b; b=a/10; //b=1234.5

What is stored in "b". Is it 1234 with the remainder truncated since it is a long?

long is an INTEGER type

I agree.

So b=1234 and the .5 is lost?

My problem is that one variable is a long long (4,971,456,512), for the arduino, largest number for a long is 4,294,967,295 (2^32)-1. How do I deal with this?

How do I deal with this?

Define "deal"

Never mind.

lsnook: So b=1234 and the .5 is lost?

Yes

lsnook: My problem is that one variable is a long long (4,971,456,512), for the arduino, largest number for a long is 4,294,967,295 (2^32)-1. How do I deal with this?

Did you try to use long long type, or int64_t?

Did you peruse Nick Gammon's writeup on big numbers? http://www.gammon.com.au/forum/?id=11519 Could be helpful also.

The remainder is truncated if you are doing integer division.

My problem is that one variable is a long long (4,971,456,512),

What does this number represent ? The number of stars in the sky ?

You don't really need this number. You should rearrange your problem so that you don't have it.

michinyon: You don't really need this number.

And how would you know?

How big exactly does a number need to get before you "don't really need it"? One thousand? Ten thousand? One million?

lsnook: My problem is that one variable is a long long (4,971,456,512), for the arduino, largest number for a long is 4,294,967,295 (2^32)-1. How do I deal with this?

The Prime Factors are: 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 11 x 73 x 3023

How is this number derived?

So the 11 rightmost binary digits are 0. This means that scaling might be used without truncation error, in your calculations.

It is true that there are some big number calcs that are unavoidable. However, it is extremely common that new programmers aren't aware that they can re-cast their problem to avoid them. That is why it is so important that you tell us what you are really doing.