Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

fixdiv(3alleg4) [debian man page]

fixdiv(3alleg4) 						  Allegro manual						   fixdiv(3alleg4)

NAME
fixdiv - Fixed point division. Allegro game programming library. SYNOPSIS
#include <allegro.h> fixed fixdiv(fixed x, fixed y); 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 fix- div(). Example: 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. */ 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. SEE ALSO
fixadd(3alleg4), fixsub(3alleg4), fixmul(3alleg4), exfixed(3alleg4) Allegro version 4.4.2 fixdiv(3alleg4)

Check Out this Related Man Page

fixdiv(3alleg4) 						  Allegro manual						   fixdiv(3alleg4)

NAME
fixdiv - Fixed point division. Allegro game programming library. SYNOPSIS
#include <allegro.h> fixed fixdiv(fixed x, fixed y); 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 fix- div(). Example: 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. */ 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. SEE ALSO
fixadd(3alleg4), fixsub(3alleg4), fixmul(3alleg4), exfixed(3alleg4) Allegro version 4.4.2 fixdiv(3alleg4)
Man Page

14 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

division problem

how can i show the value when i divide a number where the dividend is greater then the divisor. for example... 3 divided by 15 ---> let x=3/15 when i do this in the shell environment it gives me an output of 0. please help me. thanks. (3 Replies)
Discussion started by: inquirer
3 Replies

2. UNIX for Dummies Questions & Answers

Adding Trailing Spaces to a file

I have a text file which is not fixed width. I want to put trailing spaces to each line and make it a 100 byte fixed width file. Can someone please help me as soon as possible? Thanks, Denis (1 Reply)
Discussion started by: 222001459
1 Replies

3. Programming

newbie problems

(0 Replies)
Discussion started by: Gungho
0 Replies

4. Programming

CRITICAL 11/08/05 12:06:26 _getsockopt reports error. errno: 239

I am new to this socket programming stuff. I have a problem to fix.. i got the error message. "CRITICAL 11/08/05 12:06:26 _getsockopt reports error. errno: 239" can some please help me with this.. how do i go about fixing this error. thanx in advance.. (0 Replies)
Discussion started by: niks.20
0 Replies

5. Shell Programming and Scripting

how to get exact result in my division

Hello Friends, Why I am not getting exact result in the following division. It is rounding off automatically. Is there any way to get the exact result or can be set by user to get how many digits to carry after the decimal. gawk '{ wait_ns1 = (82290 +1 )/78 # actuall result =... (3 Replies)
Discussion started by: user_prady
3 Replies

6. Shell Programming and Scripting

Read variables from line to fixed length

I would like to make a script to read three variables (no fixed length or position) from a line and write them into a file, with fixed length and right-justified in each column. The fixed text (text1-text4) prior to the thee variables and the variables themselves are originally separated by spaces... (3 Replies)
Discussion started by: SharkM
3 Replies

7. Programming

errno

Hey, Can I assume that for certain function calls, errno can never be set to a certain value. More specifically, can I assume that for if the stat function call fails, the errno can never be or "No space left on device." I am assuming that a read function cannot fail because of no space... (5 Replies)
Discussion started by: the_learner
5 Replies

8. Programming

Can we debug Signals

Hi, In our program, we are using SIGTERM and i tired to put break point in this function. But my debuger is unable to brake at that point. I am working on Mac X and using XCode. Thanks (1 Reply)
Discussion started by: Saurabh78
1 Replies

9. Linux

SELinux is blocking Internet on my machine with FC9

Hi, I am facing an issue with SEliux blocking my internet usage Was searching online for its fix. I thnk their has bug raised and fixed FC10. but anybody guide to get it fixed on FC9. thanks in advance Prakash (1 Reply)
Discussion started by: prakash.kudreka
1 Replies

10. Shell Programming and Scripting

Program to insert Delimiters at fixed locations in a file, Can you please Debug it for me??

Can someone please help?I have a file - fixed.txt----------------------------AABBBBCCCCCCDDDEEFFFFGGGGGGHHHIIJJJJKKKKKKLLL----------------------------To insert delimiters at fixed lengths of 2, 4, 6, 3, I created a file text1.txt as-------------------2463----------------------and trying to execute... (10 Replies)
Discussion started by: jd_mca
10 Replies

11. Shell Programming and Scripting

division by zero

Hello, I am searching for a way to calculate for example 10/100 within a shellscript and the result should be 0.1 and not just 0. Every alternative i tried just results 0 Thank you in advance 2retti (6 Replies)
Discussion started by: 2retti
6 Replies

12. Shell Programming and Scripting

Issues when dividing

Hi, I do have a very simple task to divide 2 variables and display the result. I CANNOT use bc when i try var1=2 var2=4 var3=$(($var1 / $var2)) echo $var3 the output is always 0 What can I change to get a dotted decimal result such as 0.5 ? Thanks! (5 Replies)
Discussion started by: svetoslav_sj
5 Replies

13. Shell Programming and Scripting

Grepping text block by block by using for loop

Hei buddies, Need ur help once again. I have a file which has bunch of lines which starts from a fixed pattern and ends with another fixed pattern. I want to make use of these fixed starting and ending patterns to select the bunch, one at a time. The input file is as follows. Hi welcome... (12 Replies)
Discussion started by: anushree.a
12 Replies

14. Shell Programming and Scripting

Generate fixed length txt file

hi, i am using below query to generate the fixed length txt file. this sql is being called from shell script. This is supposed to be a fixed record file with the below definitions. There must be 2 byte filler after the CAT_ID AND each line should have total of 270 bytes. field ... (1 Reply)
Discussion started by: itzkashi
1 Replies