.dsy:it.
Show 150 posts per page

.dsy:it. (http://www.dsy.it/forum/)
- Tech (http://www.dsy.it/forum/forumdisplay.php?forumid=189)
-- [HELP] C & long long (http://www.dsy.it/forum/showthread.php?threadid=4971)


Posted by cato on 14-07-2003 16:14:

[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"


Posted by cato on 14-07-2003 16:31:

OK corretto da solo

printf("2^%d=%I64u \n",i,pow2); :D


qualcuno ha mai usato le GMP? fra un po devo passare agli interi
a 128bit :shock:

__________________

code:
  , ,  | | Me@Flickr  [ov0] | | my photo Blog  {| |} |@| Pallavolo La Nuova Rossa Milano --"-"--| | -------| | "If You Can't Open It, You Don't Own It"


Posted by Flyzone on 14-07-2003 17:43:

Originally posted by cato
printf("2^%d=%I64u \n",i,pow2); :D


ma non bastava "%lld" invece di tutto quel casino? :asd:


All times are GMT. The time now is 12:29.
Show all 3 posts from this thread on one page

Powered by: vBulletin Version 2.3.1
Copyright © Jelsoft Enterprises Limited 2000 - 2002.