PDA

View Full Version : C++ Largest Integer Usable



TreeFinger
November 7th, 2007, 10:16 AM
I am doing some Project Euler problems in C++. I am on one where you must find the largest prime factor of a very big number. that number being: 317584931803.

when compiling in Dev-C++ I get an error.
"integer constant is too large for "long" type "


the constant being the very large number.

CptPicard
November 7th, 2007, 10:42 AM
Yeah, long is 4 bytes... use a "long long". Also, we had this issue in a thread a few days back; stick "LLU" at the end of your constant, so that it's "long long unsigned"...

PaulFr
November 7th, 2007, 03:33 PM
See /usr/include/limits.h for the limits for the various integer types.