Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

div(3) [osx man page]

DIV(3)							   BSD Library Functions Manual 						    DIV(3)

div -- return quotient and remainder from division LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <stdlib.h> div_t div(int numer, int denom); DESCRIPTION
The div() function computes the value numer/denom (numerator/denominator). It returns a structure named div_t that contains two int members named quot (quotient) and rem (remainder). SEE ALSO
imaxdiv(3), ldiv(3), lldiv(3) STANDARDS
The div() function conforms to ISO/IEC 9899:1999 (``ISO C99''). BSD
November 14, 2001 BSD

Check Out this Related Man Page

DIV(3)							   BSD Library Functions Manual 						    DIV(3)

div, ldiv, lldiv, imaxdiv -- quotient and remainder from division LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <stdlib.h> div_t div(int num, int denom); ldiv_t ldiv(long int num, long int denom); lldiv_t lldiv(long long int num, long long int denom); #include <inttypes.h> imaxdiv_t imaxdiv(intmax_t num, intmax_t denom); DESCRIPTION
These functions compute the value of num / denom and return the quotient and remainder in a specific divison structure. The functions differ only with respect to the type of the return value and the parameters. The returned structure always contains two members named quot and rem, denoting the quotient and the remainder. The type of these correspond with the underlying type of the function. EXAMPLES
The following example demonstrate the basic usage of the functions. div_t d; int a = 4321; int b = 1234; d = div(a, b); (void)printf("%d %d ", d.quot, d.rem); SEE ALSO
fast_divide32(3), math(3), qdiv(3) STANDARDS
All described functions conform to ISO/IEC 9899:1999 (``ISO C99''). BSD
April 13, 2011 BSD
Man Page

14 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

fun with tar

ok, i've figured out my problem with distributed, in Solaris GUI if you click on a tar file it will untar it for you, using paramiters I don't know. now, I've got a tar file in / called dnetc-solaris26-x86.tar i want to install it to the "/Veitch" directory how exactly do I use the tar... (17 Replies)
Discussion started by: veitcha
17 Replies

2. Shell Programming and Scripting

division operation in shell script

Hi guys I am trying to divide 2 variables that I got during the execution of script, but I unable to divide the variables. pls help. Hers is the code. num_tasks=`sqlplus -s batch_user/batch_user@acsblest << EOF1 set heading off SET FEEDBACK OFF SET PAGESIZE 0 SET LINESIZE 900 select... (31 Replies)
Discussion started by: ragha81
31 Replies

3. Shell Programming and Scripting

Round with division command

Hi I want to create a list of percentages but the shell script is bugging me. If if I want to resolve the percentage of the quota used I get 0 because the schell script rounds by default. Example w1=860 w2=1024 w3=$((($w1/$w2)*100)) Echo $w3 gives 0 When I divide w1 by w2 the result... (13 Replies)
Discussion started by: vanloonmichel
13 Replies

4. UNIX for Dummies Questions & Answers

Problem in division

hi I am having two variables namely a=7 & b=8. I have to subtract these two variables. I am using the command c=`expr $a / $b` When I check the value of c, it comes out to be zero. Please help. Regards Rochit (9 Replies)
Discussion started by: rochitsharma
9 Replies

5. Shell Programming and Scripting

divided by 0 problem

Hi! i have a new shell script that will compute for a value... a = b/(b+c) c = d/(d+e) print b" "a" "d" "c but there will be an instance that either b+c or d+e will be "0".... if b+c or d+e is "0" it will print "#NA#... pls help me... thanks! (10 Replies)
Discussion started by: kingpeejay
10 Replies

6. What is on Your Mind?

Scuba Divers on the Site?

Hey! I used to dive a lot and got my PADI Open Water Diver certification many years ago. Now, I'm thinking about getting back into diving and taking a PADI Advanced Open Water diver course after a few fun refresher dives. Any divers on the site? (11 Replies)
Discussion started by: Neo
11 Replies

7. UNIX for Advanced & Expert Users

awk: division by zero

I received error "awk: division by zero" while executing the following statement. SunOS 5.10 Generic_142900-15 sun4us sparc FJSV,GPUZC-M echo 8 | awk 'END {printf ("%d\n",NR/$1 + 0.5);}' file1.lst awk: division by zero Can someone provide solution? Thanks Please use code... (11 Replies)
Discussion started by: kumar77
11 Replies

8. Shell Programming and Scripting

awk division error - 0

input 0 0 9820373 2069 0 0 11485482 awk '{print ($1/$3) / ($4/$7)}' input error Is there any way to fix this problem ? (25 Replies)
Discussion started by: quincyjones
25 Replies

9. UNIX for Dummies Questions & Answers

Dividing a column by it's first number

Hi! Is there an easy way (maybe using awk??) to divide the values of one column of the file by it's first entry.. If I have a column: 3 4 5 6 7 I would like to divide it by 3. I want to do this for more than 100 files, so it wouldn't be practical to open file by file and... (26 Replies)
Discussion started by: cosmologist
26 Replies

10. What is on Your Mind?

Port VPM Decompression Algorithm to PHP and then to Dive Computer

Hello! I'm about to embark on a new project to port the VPM (Variable Permability Model) for decompression diving from some old BASIC code (attached, "VPM.txt") to PHP. Then, I plan to create a plugin for this site where folks can run VPM on the web. Then, I plan to improve VPM based on... (15 Replies)
Discussion started by: Neo
15 Replies

11. Shell Programming and Scripting

Concatenate text between patterns in individual strings

In any given file, wherever a certain data block exists I need to concatenate the values(text after each "=" sign) from that block. in that block. The block starts and ends with specific pattern, say BEGIN DS and END DS respectively. The block size may vary. A file will have multiple such blocks.... (12 Replies)
Discussion started by: Prev
12 Replies

12. Solaris

Individual usernames for the same login account

Hi There is an application installed on a server, that has a unique login account, but many users are using it with the same login name! How can we overcame this by creating individual accounts for the same application login account? (11 Replies)
Discussion started by: fretagi
11 Replies

13. Shell Programming and Scripting

Subtract coloumn3 with coloumn 4 & divide it

I have a file called testfile as per my requirement I want to subtract coloumn3 with coloumn 4 & divide it with (1024*1024*1024)) and finally if the value is greater than 1.5 then it should be printed formula looks like this (($3-$4)/(1024*1024*1024)) more testfile 2015-01-19 00:12:32... (10 Replies)
Discussion started by: sam@sam
10 Replies

14. What is on Your Mind?

Posts Converted to Divs - Overflow Works - Now Testing

Hey, Success! I have converted the posts (each of the main posts) from table tags to div tags and the problem with the scroll bar and code tags is fixed, as I predicted (Yay!). Now I'm testing this (only I see the new results because the new code is restricted to my userid) but I would... (27 Replies)
Discussion started by: Neo
27 Replies

Featured Tech Videos