Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

trunc(3) [netbsd man page]

TRUNC(3)						   BSD Library Functions Manual 						  TRUNC(3)

trunc, truncf -- nearest integral value with magnitude less than or equal to |x| LIBRARY
Math Library (libm, -lm) SYNOPSIS
#include <math.h> double trunc(double x); float truncf(float x); DESCRIPTION
The trunc() and truncf() functions return the nearest integral value with magnitude less than or equal to |x|. They are equivalent to rint() and rintf() respectively, in the FP_RZ rounding mode. SEE ALSO
ceil(3), floor(3), fpsetround(3), math(3), nextafter(3), rint(3), round(3) STANDARDS
The trunc() and truncf() functions conform to ISO/IEC 9899:1999 (``ISO C99''). BSD
March 31, 2006 BSD

Check Out this Related Man Page

floor(3)						     Library Functions Manual							  floor(3)

floor, ceil, modf, nint, rint, trunc - Round floating-point numbers to floating-point integers, return the nearest integral value, and truncate a floating-point number LIBRARY
Math Library (libm.a) SYNOPSIS
#include <math.h> double floor (double x); float floorf (float x); long double floorl (long double x); double ceil (double x); float ceilf (float x); long double ceill (long double x); double modf (double x, double *n); float modff (float x, float *n); long double modfl (long double x, long double *n); double nint (double x); float nintf (float x); long double nintl (long double x); double rint (double x); float rintf (float x); long double rintl (long double x); double trunc (double x); float truncf (float x); long double truncl (long double x); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: floor(): XPG4 ceil(): XPG4 modf(): XPG4 rint(): XPG4-UNIX Refer to the standards(5) reference page for more information about industry standards and associated tags. DESCRIPTION
The floor(), floorf(), and floorl() functions return the largest floating-point integer value less than or equal to x. The ceil(), ceilf(), and ceill() functions return the smallest floating-point integer value greater than or equal to x. The modf(), modff(), and modfl() functions split a floating-point number x into a fractional part f and an integer part i such that |f| < 1.0 and (f + i) = x. Both f and i have the same sign as x. The modf(), modff(), and modfl() functions return f and store i into the loca- tion pointed to by n. The nint(), nintf(), and nintl() functions return the nearest integral value to x, except halfway cases are rounded to the integral value larger in magnitude. This corresponds to the FORTRAN generic intrinsic function nint(). The rint(), rintf(), and rintl() functions round x to an integral value according to the current IEEE rounding direction specified by the user. The trunc(), truncf(), and truncl() functions truncate x to an integral value. delim off floor(3)
Man Page

14 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

`ps` command truncating text

I have some processes that show a long file path as part of the process name and the process name gets truncated off. Does anyone know how to get the full output from the `ps`command so that I can see the whole process name? (9 Replies)
Discussion started by: keelba
9 Replies

2. Solaris

ps truncated output

Hi Problem of ps on Solaris 8 and 9 Perhaps a silly question but I can't find a solution. the output of the command ps -ef is truncated. I've tried to change the terminal settings with stty putting a big number of colums: no change. Following the man page of ps i have set the variable... (8 Replies)
Discussion started by: renoc
8 Replies

3. UNIX for Advanced & Expert Users

What is the cause of file truncation?

Hi, I have a program that gets called from the front end of my application. Actually it creates some temporary files and uses them and deletes them at last. But sometimes, say once in 6 times, some of these temporary files are getting truncated in the middle and because of this my program is... (9 Replies)
Discussion started by: venkatmyname
9 Replies

4. Shell Programming and Scripting

Loop through and truncate tables

Hi, I was working on the truncate oracle table shell script. The script is supplied with one table name as a parameter and I would like to change it so that it is passed a file name with a list of tables. And the script needs to truncate tables one by one by looping through the file. In other... (10 Replies)
Discussion started by: madhunk
10 Replies

5. Shell Programming and Scripting

Truncate multiple file extensions

Hi, I have files with names like file1.txt.txt.txt.txt and file2.txt.txt.txt.txt.txt............ (random infinite number of .txt exist). how to truncate (mv) their names to ones with single .txt extension like file1.txt and file1.txt ? In other words, how to extract the filename upto first... (12 Replies)
Discussion started by: prvnrk
12 Replies

6. UNIX for Dummies Questions & Answers

How can i truncate filenmes?

I am using FC6 just in case it matters, though i hope it doesn't. If i have a file or some files that i want to truncate the filename of, so that it is only a certain number of characters in length, how would i do that on the command line? Also, just to make it more interesting, say i... (11 Replies)
Discussion started by: Calum
11 Replies

7. UNIX for Dummies Questions & Answers

how to run cron job to truncate database table

hi i'm a bit stuck trying to find the correct syntax in order to run a cron job which just truncates all info from a single table in my database i have a main database - db1 and i have a table in that database - userips i wish to create a cron job that truncates or removes all the info... (9 Replies)
Discussion started by: wingchun22
9 Replies

8. Shell Programming and Scripting

Truncate file name to 40 characters

Hello all. I would like to make a script (or two shell scripts) that will do the following. I need the maximum file name and directory name to be 38 characters long. As well, if shortening the file name ends up making all of the files in that directory have the same name, then I would like... (9 Replies)
Discussion started by: marcozd
9 Replies

9. Solaris

"Processes" truncated on Solaris

ps -eo pid,ppid,uid,user,args If i use above command on any of my sol boxes,i see that fifth column (args or COMMAND) is truncated. Is there a way of getting full details in this column ,like we have in AIX? Regards Abhi (13 Replies)
Discussion started by: ak835
13 Replies

10. Shell Programming and Scripting

Truncate path and keep only filenames

Hi everyone, I have a question for you, I'm trying to create a script that will automate creating loading screens for the iPhone. So what I need to do, is list the directories inside /var/mobile/Applications and scan inside those, for the .app directory inside each. Take that .app name... (15 Replies)
Discussion started by: kicker75
15 Replies

11. Shell Programming and Scripting

How to truncate a string to x number characters?

Hello: I have a large file which contains lines like the following: 1/t123ab, &Xx:1:1234:12345:123456@ABCDEFG... at -$100.00% /t is a tab, spaces are as indicated the string "&Xx:1:1234:12345:123456$ABCDEFG..." has a slightly variable number of numbers and letters, but it always starts... (9 Replies)
Discussion started by: Tectona
9 Replies

12. Solaris

ps output truncated

Hi, I have Solaris-10 server. /usr/ucb/ps auxww is showing full path if I am running it from root. But if I run it from non-root user, its output is truncated. I don't want to use any other alternate command. Please suggest, what can be its solution. Terminal is set to term. (21 Replies)
Discussion started by: solaris_1977
21 Replies

13. UNIX for Beginners Questions & Answers

Remove or truncate trailing nulls from file

I want to remove from a file the trailing null characters (0x00) and stop doing so when a different byte is found (which should not be deleted), and either put the result to the same file or a different one. Any ideas? (9 Replies)
Discussion started by: Tribe
9 Replies

14. UNIX for Dummies Questions & Answers

Remove or truncate trailing nulls from file

(9 Replies)
Discussion started by: Tribe
9 Replies