Mail Archives: djgpp/1998/04/01/03:25:45
On 31 Mar 1998, Alan Carter wrote:
> float xlen,ylen,ang,res,sub;
> res=sub=xlen=ylen=ang=0;
>
> xlen=fabs(x1-x2);
> ylen=fabs(y1-y2);
>
> res=xlen/ylen;
>
> sub=atan(res); // << -- this is the little bugger causing
You pass a float argument to `atan', which expects a double. GCC will
perform the conversion for you, but only if your source file says
#include <math.h> somewhere. If you didn't do that, that's why it
crashes.
Also, it's a good idea to use the -Wall switch to GCC, it will catch many
such bugs in embryo.
- Raw text -