Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

fixsub(3alleg4) [netbsd man page]

fixsub(3alleg4) 						  Allegro manual						   fixsub(3alleg4)

NAME
fixsub - Safe function to subtract fixed point numbers clamping underflow. Allegro game programming library. SYNOPSIS
#include <allegro.h> fixed fixsub(fixed x, fixed y); DESCRIPTION
Although fixed point numbers can be subtracted with the normal '-' integer operator, that doesn't provide any protection against overflow. If overflow is a problem, you should use this function instead. It is slower than using integer operators, but if an overflow occurs it will set `errno' and clamp the result, rather than just letting it wrap. Example: fixed result; /* This will put 4965 into `result'. */ result = fixsub(itofix(5000), itofix(35)); /* Sets `errno' and puts -32768 into `result'. */ result = fixsub(itofix(-31000), itofix(3000)); ASSERT(!errno); /* This will fail. */ RETURN VALUE
Returns the clamped result of subtracting `y' from `x', setting `errno' to ERANGE if there was an overflow. SEE ALSO
fixadd(3alleg4), fixmul(3alleg4), fixdiv(3alleg4) Allegro version 4.4.2 fixsub(3alleg4)

Check Out this Related Man Page

fixsub(3alleg4) 						  Allegro manual						   fixsub(3alleg4)

NAME
fixsub - Safe function to subtract fixed point numbers clamping underflow. Allegro game programming library. SYNOPSIS
#include <allegro.h> fixed fixsub(fixed x, fixed y); DESCRIPTION
Although fixed point numbers can be subtracted with the normal '-' integer operator, that doesn't provide any protection against overflow. If overflow is a problem, you should use this function instead. It is slower than using integer operators, but if an overflow occurs it will set `errno' and clamp the result, rather than just letting it wrap. Example: fixed result; /* This will put 4965 into `result'. */ result = fixsub(itofix(5000), itofix(35)); /* Sets `errno' and puts -32768 into `result'. */ result = fixsub(itofix(-31000), itofix(3000)); ASSERT(!errno); /* This will fail. */ RETURN VALUE
Returns the clamped result of subtracting `y' from `x', setting `errno' to ERANGE if there was an overflow. SEE ALSO
fixadd(3alleg4), fixmul(3alleg4), fixdiv(3alleg4) Allegro version 4.4.2 fixsub(3alleg4)
Man Page

10 More Discussions You Might Find Interesting

1. Programming

c++ overflow problem

I have come accross a rather strange problem with two buffers that seem to be overriding each other. bool killSession(const Session &session){ //Get user FILE* fp = fopen("conf/sessions.current", "rt"); char line; char user; int x = 0; int leaseTime; printf("key: %s \n" ,... (2 Replies)
Discussion started by: mshindo
2 Replies

2. HP-UX

Explain this error please

please any one can tell me how can i solve this problem in sam it is work fine but when i am traing to add fixed client to the ignite server this error appears A SAM internal error has occurred. │ ^ │ ││ │ The error handler has gotten the error code -152 of... (1 Reply)
Discussion started by: maxim42
1 Replies

3. Shell Programming and Scripting

Parsing log with sed problem

I have huge logs that have sql statements in them and I need to parse those statements out. Log sample: OUT1: #STMT# from: : 2010.12.20 14:01:16.357--DatabaseSessionImpl(17489534)--Connection(11145468)--Thread(Thread)--SELECT GETDATE() : 2010.12.20... (19 Replies)
Discussion started by: migurus
19 Replies

4. Shell Programming and Scripting

result in variable

Hi all, I'll try to get a result from a search with "awk" into a variable. It works for those examples: findfirstline=`awk 'BEGIN{ mycount = 1 } { if(mycount == 1 && /^Video/){ row=NR; print row; mycount = 0; }}' ${i}` findlastline=`awk '/^Video/ {row=NR} END{print row}' ${i}` But it... (6 Replies)
Discussion started by: tempestas
6 Replies

5. Programming

Storing input + some text into a variable (C Programming)

Hey guys got a slight problem here, I kindda new to socket programming in C so I need some guide on how to store something like this in a variable. printf ("%s Name : %s\n", id,getNAME(name)); name is declared as name. The getName is a function. So what I'm... (7 Replies)
Discussion started by: aLHaNz
7 Replies

6. Shell Programming and Scripting

Searching columns and subtracting values in awk

Hi everyone, I had a similar question a couple days ago but my problem has gotten significantly (to me anyway) more complex. I have two files: File 1: 0808 166 166 62 9 0 1000fights 1 1 2 1 0 100places2visit 2 2 2 2 0 10veronica91 167 167 3 1 0 11thgorgeous 346 346 3806 1461 122... (2 Replies)
Discussion started by: collards
2 Replies

7. Shell Programming and Scripting

Subtracting values from variable

Legends, Please help me in , how do i subtract the variable values listed like below. the first value of orig should be subtracted from first value of prev and so on. san> echo $orig 346 316 340 239 410 107 291 139 128 230 167 147 159 159 172 116 110 260 177 0 177 169 168 186 165 366 195... (15 Replies)
Discussion started by: sdosanjh
15 Replies

8. Shell Programming and Scripting

awk - Read fixed format

Hi, I have several fixed format ascii files which I would like to reformat through Awk. The fixed format produces intermittent whitespace (Nastran input file). $ Grid points $------1-------2-------3-------4-------5-------6-------7-------8-------9-------0 GRID* 1... (6 Replies)
Discussion started by: Tim Gowing
6 Replies

9. Shell Programming and Scripting

Replace and Increment a value in the fixed length file

Hi Everyone, I need to increment a value in the fixed length file. The file has almost a million rows. Is there any easy way to accomplish this. Ex input file ASDSD ADSD 00000 X AAASD ADSD 00000 X SDDDD ADSD 00000 X Ouput ASDSD ADSD 00001 X AAASD ADSD 00002 X SDDDD ADSD 00003 X ... (7 Replies)
Discussion started by: saratha14
7 Replies

10. Shell Programming and Scripting

Long file record

riends I have the following problem: test.txt I have a file that has the following contents: is a fixed-length file to the end of the number 12 has spaces, so that it is fixed length 123456789 123456789 123456789 12 This code shows me the length of each record, but in... (2 Replies)
Discussion started by: tricampeon81
2 Replies