ROUND(3) Linux Programmer's Manual ROUND(3)NAME
round, roundf, roundl - round to nearest integer, away from zero
SYNOPSIS
#include <math.h>
double round(double x);
float roundf(float x);
long double roundl(long double x);
DESCRIPTION
These functions round x to the nearest integer, but round halfway cases away from zero (regardless of the current rounding direction),
instead of to the nearest even integer like rint().
RETURN VALUE
The rounded integer value. If x is integral or infinite, x itself is returned.
ERRORS
No errors other than EDOM and ERANGE can occur. If x is NaN, then NaN is returned and errno may be set to EDOM.
NOTES
POSIX 1003.1-2001 contains text about overflow (which might set errno to ERANGE, or raise an exception). In practice, the result cannot
overflow on any current machine, so this error-handling stuff is just nonsense. (More precisely, overflow can happen only when the maximum
value of the exponent is smaller than the number of mantissa bits. For the IEEE-754 standard 32-bit and 64-bit floating point numbers the
maximum value of the exponent is 128 (resp. 1024), and the number of mantissa bits is 24 (resp. 53).)
CONFORMING TO
C99.
SEE ALSO ceil(3), floor(3), lround(3), nearbyint(3), rint(3), trunc(3)
2001-05-31 ROUND(3)
Check Out this Related Man Page
ROUND(3) Linux Programmer's Manual ROUND(3)NAME
round, roundf, roundl - round to nearest integer, away from zero
SYNOPSIS
#include <math.h>
double round(double x);
float roundf(float x);
long double roundl(long double x);
DESCRIPTION
These functions round x to the nearest integer, but round halfway cases away from zero (regardless of the current rounding direction),
instead of to the nearest even integer like rint().
RETURN VALUE
The rounded integer value. If x is integral or infinite, x itself is returned.
ERRORS
No errors other than EDOM and ERANGE can occur. If x is NaN, then NaN is returned and errno may be set to EDOM.
NOTES
POSIX 1003.1-2001 contains text about overflow (which might set errno to ERANGE, or raise an exception). In practice, the result cannot
overflow on any current machine, so this error-handling stuff is just nonsense. (More precisely, overflow can happen only when the maximum
value of the exponent is smaller than the number of mantissa bits. For the IEEE-754 standard 32-bit and 64-bit floating point numbers the
maximum value of the exponent is 128 (resp. 1024), and the number of mantissa bits is 24 (resp. 53).)
CONFORMING TO
C99.
SEE ALSO ceil(3), floor(3), lround(3), nearbyint(3), rint(3), trunc(3)
2001-05-31 ROUND(3)
Well to start off, let me say hello to every one! Im a bit new on the forum, I just signed up, but Ive been working with Unix like systems for a few years now. I have this old i486 sx that I found in my closet and I want to load a Unix onto it although Im not too sure what it might handle. I... (3 Replies)
Hi all,
How can i parallize this code in pthread?
for(round=1;round<=16;round++)
{
Expansion(mid, 17 - round - 1, left);
Expansion(mid, round - 1, right);
round++;
Expansion(right, 17 - round - 1, mid);
Expansion(left, round - 1,mid);
}
Whereby each loop depend on the... (2 Replies)
Hey guys I would like to know how to find nearest numbers based on second column in 1st column some thing like this
Input
col1 col2
10 20
30 40
48 64
55 71
70 90
output
col1 col2 col3
10 20 30
30 40 48
48 64 70
55 71
70 90 (1 Reply)
Hi,
I have managed to round up numbers by using the following command:
echo "5.54" | awk '{printf "%.0f\n", $1}'
result
6
How can I round up all the numbers in a column in a file and print the lines with the new calculated totals?
Thanks, (3 Replies)
Hi all of you,
Would be great if you help me with how to round up to whole number from my input values like
2.99996,2.17890,3.00002,-2.3456,-2.7890
o/p should be like 3,2,3,-2,-3
thnks in adv!!!!
regards (3 Replies)
Hi,
I wanted to round all the values in a column to nearest integer. I have multiple files with only two columns and I want to round values in column 2. e.g
input_file
A1 23.971578 A2 34.624976 A3 46.403446 A4 375 A5 1 A6 3 A7 ... (3 Replies)
Hello,
I am using bash shell on Linux OS, May i please know why is it rounding for big numbers but not for others, is there a workaround to print it as it is with out round off?
printf '%'\''.2f\n' 9999999999999999999.99
10,000,000,000,000,000,000.00
printf '%'\''.2f\n' 99999999999999.99... (1 Reply)
I am trying to convert decimal value of last two digit to round but fail.
I am using this method
awk '/HORIZONTAL/,/VERTICAL/' $1 | sed '1d;$d' | awk -F " " '{print $2}'| xargs printf '%1.1f\n'| grep -oP '\S+' | tr -s "\n" " " |sed 's/ *$//'
Input
0.01
0.02
0.03
0.05
0.07
0.10... (3 Replies)