Author: Uri Blass
Date: 06:00:27 12/07/01
Go up one level in this thread
On December 07, 2001 at 01:46:57, Uri Blass wrote:
>On December 07, 2001 at 00:22:19, Miguel A. Ballicora wrote:
>
>>On December 07, 2001 at 00:20:18, Miguel A. Ballicora wrote:
>>
>>sorry, I pressed enter too early
>>
>>int64tostring (long long x, char *s)
>>{ unsigned int a = x/1000000;
>> unsigned int b = x%1000000;
>> if (x>1000000)
>> sprintf(s,"%d%d",a,b);
>> else
>> sprintf(s,"%d",b);
>> return s;
>>}
>>
>>then you use
>>
>>long long x;
>>char buffer[64]
>>printf("nodes: %s\n",int64tostring(x,buffer));
>>
>>Miguel
>
>I may try it
>Here is my way to print long numbers(I needed it to print perft 8 from the
>initial position when mone is perft 8)
>
>
>printf(" %d",mone/1000000);
> mone=mone-1000000*(mone/1000000);
> if (mone<100000) printf("0");
> if (mone<10000) printf("0");
> if (mone<1000) printf("0");
> if (mone<100) printf("0");
> if (mone<10) printf("0");
> printf("%d",mone);
>
>Uri
I did not understand exactly what you do
1)My program does not understand the meaning of long long
I get error C2632: 'long' followed by 'long' is illegal
I guess that you probably mean __int64 so I cahnged every long long to __int64
2)I also do not understand how can you do return s when your function returns
nothing so I changed the name to from int64tostring that to only tostring and
let it return char *
3)I also changed unsigned int to __int64 because I get the following warning
warning C4244: 'initializing' : conversion from '__int64 ' to 'unsigned int ',
possible loss of data
I got the following function but it simply does not work
char * tostring (__int64 x, char *s)
{ __int64 a = x/1000000;
__int64 b = x%1000000;
if (x>1000000)
sprintf(s,"%d%d",a,b);
else
sprintf(s,"%d",b);
return s;
}
I tested my program by the following code
char buffer[64];
__int64 mone;
mone=(1<<30);
printf("mone: %s\n",tostring(mone,buffer));
and I get the wrong output 10730 when the right output should be 2^30=1073741824
Uri
This page took 0.01 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.