[Bugzilla] [Bug 15442] Stéphane MOTTELET has commented the bug
bugzilla.admin at scilab.org
bugzilla.admin at scilab.org
Thu Mar 15 17:32:59 CET 2018
http://bugzilla.scilab.org/show_bug.cgi?id=15442
--------- Bug Summary -----------
printf cannot handle uint64 integers greater than 2^32-1
---------- Changed by ------------
stephane.mottelet at utc.fr
---------- What changed ----------
--- Comment #10 from Stéphane MOTTELET <stephane.mottelet at utc.fr> ---
Under Linux, printf is anyway buggy, as the following code x=uint64(2^32-1)
x=uint64(2^32)
printf("%u\n",x)
printf("%lu\n",x)
printf("%d\n",x)
printf("%ld\n",x)
displays
0
4294967296
-2147483648
2147483648
i.e. OK (by which miracle) for %lu but erroneous for %d and %ld.
To me the reference behavior (and the one obtained in Scilab after the proposed patch) is the one of the following C code :
#include <stdio.h>
int main()
{
unsigned long int x=4294967296;
printf("%u\n",x);
printf("%lu\n",x);
printf("%d\n",x);
printf("%ld\n",x);
return 0;
}
which outputs, under all operating systems
0
4294967296
0
4294967296
--
You are receiving this mail because:
You are watching all bug changes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/bugzilla/attachments/20180315/b030e10e/attachment.htm>
More information about the Bugzilla
mailing list