|
|
|
|
 |
|  |
 |
cato |
| [HELP] C & long long |
14-07-2003 16:14 |
|
 |
cato |
Wild boys always shine

Registered: Nov 2001
Posts: 5608 (0.63 al dì)
Location: lecco
Corso: F28
Anno: dottore
Time Online: 38 Days, 5:42:41 [...]
Status: Offline
Edit | Report | IP: Logged |
[HELP] C & long long
devo usare in un programma il tipo long long (int 64bit)
con gcc ma i risultati mi sembrano abbastanza bizzarri
can you help me?
include <stdio.h>
long long pow2=1;
int i;
int main ()
{
for (i=0;i<64;i++){
printf("2^%d=%llu \n",i,pow2);
pow2=pow2*2;}
return 0;
}
Michele@INFERNO ~
$ ./t64
2^0=1
2^1=2
2^2=4
2^3=8
2^4=16
2^5=32
2^6=64
2^7=128
2^8=256
2^9=512
2^10=1024
2^11=2048
2^12=4096
2^13=8192
2^14=16384
2^15=32768
2^16=65536
2^17=131072
2^18=262144
2^19=524288
2^20=1048576
2^21=2097152
2^22=4194304
2^23=8388608
2^24=16777216
2^25=33554432
2^26=67108864
2^27=134217728
2^28=268435456
2^29=536870912
2^30=1073741824
2^31=2147483648
2^32=0
2^33=0
2^34=0
2^35=0
2^36=0
2^37=0
2^38=0
2^39=0
2^40=0
2^41=0
2^42=0
2^43=0
2^44=0
2^45=0
2^46=0
2^47=0
2^48=0
2^49=0
2^50=0
2^51=0
2^52=0
2^53=0
2^54=0
2^55=0
2^56=0
2^57=0
2^58=0
2^59=0
2^60=0
2^61=0
2^62=0
2^63=0
__________________
code: , , | | Me@Flickr
[ov0] | | my photo Blog
{| |} |@| Pallavolo La Nuova Rossa Milano
--"-"--| |
-------| | "If You Can't Open It, You Don't Own It"
|
|
14-07-2003 16:14 |
|
|
|  |
 |
cato |
| OK corretto da solo
... |
14-07-2003 16:31 |
|
 |
cato |
Wild boys always shine

Registered: Nov 2001
Posts: 5608 (0.63 al dì)
Location: lecco
Corso: F28
Anno: dottore
Time Online: 38 Days, 5:42:41 [...]
Status: Offline
Edit | Report | IP: Logged |
OK corretto da solo
printf("2^%d=%I64u \n",i,pow2);
qualcuno ha mai usato le GMP? fra un po devo passare agli interi
a 128bit 
__________________
code: , , | | Me@Flickr
[ov0] | | my photo Blog
{| |} |@| Pallavolo La Nuova Rossa Milano
--"-"--| |
-------| | "If You Can't Open It, You Don't Own It"
|
|
14-07-2003 16:31 |
|
|
|  |
 |
Flyzone |
| [QUOTE][i]Originally posted by cato [/i]
... |
14-07-2003 17:43 |
|
 |
Flyzone |
.coltellino:svizzero.
Registered: Jan 2003
Posts: 1956 (0.23 al dì)
Location:
Corso:
Anno:
Time Online: 19 Days, 22:20:19 [...]
Status: Offline
Edit | Report | IP: Logged |
Originally posted by cato
printf("2^%d=%I64u \n",i,pow2); 
ma non bastava "%lld" invece di tutto quel casino? 
|
|
14-07-2003 17:43 |
|
|
|  |
 |
| All times are GMT. The time now is 05:02. |
|
|
 |
|
 |
|
|
|  |
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is ON
|
|
|
|
|
|