.\" Generated by the Allegro makedoc utility .TH fixdiv 3alleg4 "version 4.4.3" "Allegro" "Allegro manual" .SH NAME fixdiv \- Fixed point division. Allegro game programming library.\& .SH SYNOPSIS .B #include .sp .B fixed fixdiv(fixed x, fixed y); .SH DESCRIPTION A fixed point value can be divided by an integer with the normal `/' operator. To divide two fixed point values, though, you must use this function. If a division by zero occurs, `errno' will be set and the maximum possible value will be returned, but `errno' is not cleared if the operation is successful. This means that if you are going to test for division by zero you should set `errno=0' before calling fixdiv(). Example: .nf fixed result; /* This will put 0.06060 `result'. */ result = fixdiv(itofix(2), itofix(33)); /* This will put 0 into `result'. */ result = fixdiv(0, itofix(-30)); /* Sets `errno' and puts -32768 into `result'. */ result = fixdiv(itofix(-100), itofix(0)); ASSERT(!errno); /* This will fail. */ .fi .SH "RETURN VALUE" Returns the result of dividing `x' by `y'. If `y' is zero, returns the maximum possible fixed point value and sets `errno' to ERANGE. .SH SEE ALSO .BR fixadd (3alleg4), .BR fixsub (3alleg4), .BR fixmul (3alleg4), .BR exfixed (3alleg4)