www.digitalmars.com         C & C++   DMDScript  

c++.rtl - printf bug for 64 bit integer output in binary

reply Carl Sturtivant <Carl_member pathlink.com> writes:
It seems that if bit 48 or above is set then there's a problem with printf
producing binary, shown by the short program below. If bit 56 or above is set
then the problem is more severe. Any chance of a fix?  :) 
Carl.

#include <stdio.h>

int main(int argc, char* argv[]){
int i;
unsigned long long b;
for( i=48; i<56; ++i) {
b= 1ULL << i;
printf("%064llb\n%llu\n", b, b);
}
return 0;
}
Dec 16 2005
parent reply "Walter Bright" <newshound digitalmars.com> writes:
"Carl Sturtivant" <Carl_member pathlink.com> wrote in message 
news:dnvdtg$2pu7$1 digitaldaemon.com...
 It seems that if bit 48 or above is set then there's a problem with printf
 producing binary, shown by the short program below. If bit 56 or above is 
 set
 then the problem is more severe. Any chance of a fix?  :)
 Carl.

 #include <stdio.h>

 int main(int argc, char* argv[]){
 int i;
 unsigned long long b;
 for( i=48; i<56; ++i) {
 b= 1ULL << i;
 printf("%064llb\n%llu\n", b, b);
 }
 return 0;
 }

Try downloading the latest beta and see if that works.
Dec 19 2005
parent reply Carl Sturtivant <Carl_member pathlink.com> writes:
In article <do74cb$1gj9$4 digitaldaemon.com>, Walter Bright says...
Try downloading the latest beta and see if that works. 

If that's 8.45c, then that's what I ran under when I checked the bug still existed. Otherwise, where do I get the latest beta? Carl.
Dec 19 2005
parent "Walter Bright" <newshound digitalmars.com> writes:
"Carl Sturtivant" <Carl_member pathlink.com> wrote in message 
news:do78tm$1mkh$1 digitaldaemon.com...
 If that's 8.45c, then that's what I ran under when I checked the bug still
 existed. Otherwise, where do I get the latest beta?
 Carl.

Yes, the bug is still there. I'll check into it.
Jan 22 2006