One of my variables is fdco=4,850,000,000. Using the Arduino Uno.
This number is too large for unsigned long (max=2^32)-1=4,294,967,295
I have tried scaling this number but the program gets too messy because then all of the variable must be scaled.
What should I do?
C has a long long type, usually 64 bit.
long long foo;
Don't know if arduino supports it - I don't have my compiler with me.
But is there any reason you can't use a float or double? Numbers that big - it's not often they need to be accurate to the digit.
I don't see long long in the command index.
Let me try your suggestion, float.
Thanks!!
It appears that the Serial object doesn't like long long, but the data type is supported:
void setup() {
long long fdco = 4850000000;
long answer;
Serial.begin(9600);
answer = fdco / 1000;
Serial.println(answer); // Had to divide it because println() doesn't like long long
}
void loop() {
// put your main code here, to run repeatedly:
}