Sponsored Content
Full Discussion: FLOOR Func
Top Forums Shell Programming and Scripting FLOOR Func Post 302140982 by user_prady on Wednesday 17th of October 2007 03:49:03 AM
Old 10-17-2007
FLOOR Func

Hello Experts,

Is there any inbuild FLOOR function to do FLOOR func in mathmetics in awk script like in FlOOR Func in C.

Ex:- floor(2.9) = 2
floor(2.1) = 2
floor(2.0) = 2
floor(-2.0) = 2
floor(-2.1) = -3
floor(-2.9) = -3

If there does not exist in awk script please help me some tricks to do it ...


Thanks in advance..
User_prady

Last edited by user_prady; 10-17-2007 at 05:46 AM..
 

7 More Discussions You Might Find Interesting

1. Programming

request_irq func. header file?

I try to compile program which use request_irq function declarated in linux/sched.h but it bring a lot of errors relating to include directives in sched.h. I try on Mandrake7.2 and RedHat7.2 but result same. A lot of thanks for your answers. (2 Replies)
Discussion started by: ppphah
2 Replies

2. Programming

difference between int ** func() and int *& func()

What is the difference between int** func() and int*& func(). Can you please explain it with suitable example. Thanks, Devesh. (1 Reply)
Discussion started by: devesh
1 Replies

3. Shell Programming and Scripting

Utilizing func keys in scripts

I would like to have the function keys available to me in my scripts. Anyone have any ideas on how to map these to functionality I design? :confused: (3 Replies)
Discussion started by: fjjlee
3 Replies

4. Red Hat

Video: Spotlight on FUNC

</p>Download this video: Ogg Theora] FUNC is the brainchild of Michael DeHaan, Adrian Likins, Seth Vidal, and Greg DeKoenigsberg. In this edition of Spotlight On, Michael, Adrian, and Seth discuss how FUNC makes it easy to write commands across large numbers of machines remotely and... (0 Replies)
Discussion started by: Linux Bot
0 Replies

5. Shell Programming and Scripting

CEILING and FLOOR functions

Hi all, Does anyone know how to simulate a ceiling or floor function in UNIX? OS is Solaris. I tried the suggestion from an old forum but it is giving me error as below: server01/tmp$: echo "7.2" | awk '{printf("%d\n",$0+=$0<0?0:0.999)}' awk: syntax error near line 1 awk: illegal... (3 Replies)
Discussion started by: newbie_01
3 Replies

6. Programming

Round floor behavior

Hello, My round and floor functions in C program behaves weird. Can someone help resolve the issue.. fprintf( fp, "ROUND TEST VARIABLE 11686776.000000 %d\n", round(11686776.000000)); fprintf( fp, "ROUND TEST VARIABLE 1168677.000000 %d\n", round(1168677.000000)); fprintf( fp, "FLOOR... (3 Replies)
Discussion started by: anijan
3 Replies

7. UNIX for Beginners Questions & Answers

What is MB/CMP0/PCI_MEZZ/BR0-FUNC ?

Hello, I have a T5220 server, which is out of support from Oracle support now. Recently I had to reboot it and I am noticing a part failure in its boot logs. Though it comes on login prompt, but I am not able to find,what this part is and if I leave it like this, can it impact anything ? It is... (1 Reply)
Discussion started by: solaris_1977
1 Replies
FLOOR(3M)																 FLOOR(3M)

NAME
fabs, floor, ceil, rint - absolute value, floor, ceiling, and round-to-nearest functions SYNOPSIS
#include <math.h> double floor(x) double x; double ceil(x) double x; double fabs(x) double x; double rint(x) double x; DESCRIPTION
Fabs returns the absolute value |x|. Floor returns the largest integer no greater than x. Ceil returns the smallest integer no less than x. Rint returns the integer (represented as a double precision number) nearest x in the direction of the prevailing rounding mode. NOTES
On a VAX, rint(x) is equivalent to adding half to the magnitude and then rounding towards zero. In the default rounding mode, to nearest, on a machine that conforms to IEEE 754, rint(x) is the integer nearest x with the additional stipulation that if |rint(x)-x|=1/2 then rint(x) is even. Other rounding modes can make rint act like floor, or like ceil, or round towards zero. Another way to obtain an integer near x is to declare (in C) double x; int k; k = x; Most C compilers round x towards 0 to get the integer k, but some do otherwise. If in doubt, use floor, ceil, or rint first, whichever you intend. Also note that, if x is larger than k can accommodate, the value of k and the presence or absence of an integer overflow are hard to predict. SEE ALSO
abs(3), ieee(3M), math(3M) 4th Berkeley Distribution May 12, 1986 FLOOR(3M)
All times are GMT -4. The time now is 05:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy