tester@brb.isnet.inmos.co.uk (10/19/90)
From : Steve, Inmos, UK. Date : 19 October 1990 Subj : re:Help with Megamax. In reply to my own message, which was :- >I am using the Megamax C compiler to write a program >which will perform maths on long words. I am having >trouble getting a long variable to hold the number >#80000000 (ie the most negative number possible in four >bytes). >It does not seem to matter whether the number in inputted >in hex, decimal or binary and I have tried putting in the >number #80000001 (which works fine) and then subtracting 1. >When I try to print the result I get the characters >'(..*()-)' or similar. The program does not crash, but then >it does not give the correct result either. Further investigation has revealed that the printf routine appears to be the cause of the trouble. The routine will print the hex version of #80000000 correctly but fails to print the long decimal version. ie printf("%lx\n",0x80000000L) gives 80000000 but printf("%ld\n",0x80000000L) gives -(..*)---) (or something!) Maths on the number appears to work. I dont need to print the number out in decimal so -my- problem has now gone away. Thanks to Gary at Inmos for the help, Steve, Inmos, UK.