1748265 Members
4095 Online
108760 Solutions
New Discussion юеВ

Re: large integer in C

 
Dennis Handly
Acclaimed Contributor

Re: large integer in C

>Laurent: It will work better because the calculation is made in int until we * by a LL

It may work better for variables but for constants that are evaluated at compile time, it may not make a difference. I.e. all internal calculations may be done in long double then truncated.
Laurent Menase
Honored Contributor

Re: large integer in C

on on hpux compiler when you define a constant as 4096 it is an int,
so if you multiply int*int*int it gives an int
and you get an overflow warning at compilation.

Dennis Handly
Acclaimed Contributor

Re: large integer in C

>Laurent: on on hpux compiler when you define a constant as 4096 it is an int,

If this was in regards to my comment, you misunderstood. I meant that you won't always benefit by using LL on the third constant, instead of the first.