.\" Automatically generated by Pandoc 3.1.3 .\" .\" Define V font for inline verbatim, using C font in formats .\" that render this, and otherwise B font. .ie "\f[CB]x\f[]"x" \{\ . ftr V B . ftr VI BI . ftr VB B . ftr VBI BI .\} .el \{\ . ftr V CR . ftr VI CI . ftr VB CB . ftr VBI CBI .\} .TH "al_fixdiv" "3alleg5" "" "Allegro reference manual" "" .hy .SH NAME .PP al_fixdiv - Allegro 5 API .SH SYNOPSIS .IP .nf \f[C] #include al_fixed al_fixdiv(al_fixed x, al_fixed y); \f[R] .fi .SH DESCRIPTION .PP A fixed point value can be divided by an integer with the normal \f[V]/\f[R] operator. To divide two fixed point values, though, you must use this function. If a division by zero occurs, Allegro\[cq]s 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 call \f[V]al_set_errno(0)\f[R] before calling al_fixdiv(3alleg5). .PP Example: .IP .nf \f[C] al_fixed result; /* This will put 0.06060 \[ga]result\[aq]. */ result = al_fixdiv(al_itofix(2), al_itofix(33)); /* This will put 0 into \[ga]result\[aq]. */ result = al_fixdiv(0, al_itofix(-30)); /* Sets errno and puts -32768 into \[ga]result\[aq]. */ result = al_fixdiv(al_itofix(-100), al_itofix(0)); assert(!al_get_errno()); /* This will fail. */ \f[R] .fi .SH RETURN VALUE .PP Returns the result of dividing \f[V]x\f[R] by \f[V]y\f[R]. If \f[V]y\f[R] is zero, returns the maximum possible fixed point value and sets Allegro\[cq]s errno to ERANGE. .SH SEE ALSO .PP al_fixadd(3alleg5), al_fixsub(3alleg5), al_fixmul(3alleg5), al_get_errno(3alleg5).