Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

fixsub(3alleg4) [debian 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

15 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to chk the file name using wildcards??

Hi, I need to find a file with name xyz.mno.1234235.msg Here the numbers can be anything and is not fixed. But the first 6 characters are fixed ie, xyz and mno are fixed and wont change. Actually this file comes to this directory every week with only the number part changing. How is it... (7 Replies)
Discussion started by: RRVARMA
7 Replies

2. Shell Programming and Scripting

Curious question? How to put a string into two columns.

Now I have a list of numbers in hand and I try to put the numbers into two columns. Can I do this work with any script? Great thanks to your help! 1A1.log HF=-240.451527 HF=-240.5213996 1A2.log HF=-240.451527 HF=-240.5213996 1B.log HF=-240.4273718 HF=-240.4956636 1C.log... (7 Replies)
Discussion started by: liuzhencc
7 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. Programming

putting numbers behind eachother

I want to make a program where you have to insert binary numbers like this: do { iBinary = getche(); }while(iBinary == 1 || iBinary == 0); after you get the numbers I want them to be placed behind eachother so you will get: input: 1 1 0 1 output: 1101 (7 Replies)
Discussion started by: metal005
7 Replies

7. Shell Programming and Scripting

Sequential numbers

Hi All, I am looking for a simple way to write numbers to a file sequentially starting from 1 and ending on a specified upper limit. Example of the output file is below Example 1 2 3 4 5 . . . . 1000 please let me know the best way to do it. (10 Replies)
Discussion started by: Lucky Ali
10 Replies

8. UNIX for Dummies Questions & Answers

List into one line?

Probably, something really easy to do and stupid to ask help with it, but how to turn a list of numbers into one line of numbers. I have: , 116332682 , 116332683 , 116332685 , 116332686 , 116332687 , 116332688 , 116332689 ,... (6 Replies)
Discussion started by: Iifa
6 Replies

9. Shell Programming and Scripting

Replace Date in a fixed length file

Hello All, I working on ksh. I am using fixed length file. My file is like: ======== IXTTIV110827 NANTH AM IKSHIT ABCDEF 0617 IJAY NAND EENIG ZXYWVU 0912 AP OOK OONG PQRSTU100923 NASA DISH TTY ASDFG 0223 GHU UMA LAM QWERT 0111 ATHE SH THEW ======= From 7th to 12 is a date... (4 Replies)
Discussion started by: AnanthaDikshit
4 Replies

10. Shell Programming and Scripting

Logic needed

input : employee_id, salary ------------------- 10, 1000 20, 2000 30, 3000 40, 5000 output: employee_id, salary, next_row_salary ------------------------------------ 10, 1000, 2000 20, 2000, 3000 30, 3000, ... (3 Replies)
Discussion started by: HemaV
3 Replies

11. 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

12. Shell Programming and Scripting

Splitting fixed length file using awk

Hi, I need to split a fixed length file of 160 characters based on value of a column. Example: ABC 456780001 DGDG SDFSF BCD 444440002 SSSS TTTTT ABC 777750003 HHHH UUUUU THH 888880001 FFFF LLLLLL HHH 999990002 GGGG OOOOO I need to split this file on basis of column from... (7 Replies)
Discussion started by: Neelkanth
7 Replies

13. 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

14. 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

15. Programming

Compiler/Runtime uses of sizeof

Ignoring other considerations for a moment and in general ... Would there be a difference in result (dot oh or execution) of: A. strncpy( a, b, sizeof(a) ); vs. B. c = sizeof(a); strncpy( a, b, c ); My general understanding is (at least I think my understanding is) that... (10 Replies)
Discussion started by: GSalisbury
10 Replies