sam@gt-eedsp.UUCP (Sam Smith) (12/08/87)
I found the following bug in Turboc v1.0. The same program works
correctly under MSC 4.0 and Unix C.
#include <stdio.h>
#include <math.h>
main()
{
long longvalue;
float floatvalue;
floatvalue = -100.0;
printf("%f\n", floatvalue);
longvalue = (long)floatvalue;
printf("%ld\n", longvalue);
}
output:
-100.0
65436
The second number should be -100 not 65436. This program works for
positive floats and doubles.
From what I can figure out the call to _ftol should return the long
value in DX:AX. AX is correct, DX should be 0xffff but is actually
0x0000. DX is not getting sign extended.
Sam Smith
Digital Signal Processing Lab, Georgia Tech, Atlanta GA 30332
Internet: sam%gteedsp@gatech.gatech.edu
uucp: ...!{decvax,hplabs,ihnp4,linus,rutgers,seismo}!gatech!gt-eedsp!sam
--
Sam Smith
Digital Signal Processing Lab, Georgia Tech, Atlanta GA 30332
Internet: sam%gteedsp@gatech.gatech.edu
uucp: ...!{decvax,hplabs,ihnp4,linus,rutgers,seismo}!gatech!gt-eedsp!sam