Sponsored Content
Full Discussion: Round floor behavior
Top Forums Programming Round floor behavior Post 303016015 by Don Cragun on Wednesday 18th of April 2018 07:41:26 AM
Old 04-18-2018
How did you declare these functions in your source code?

What compiler are you using?

What compiler options did you use when you compiled your source code?

What diagnostics were produced when you compiled your source code?

What operating system are you using?

My guess would be that you didn't #include <math.h> or specify appropriate function prototypes for floor() and round(). Without including the proper header or supplying appropriate function prototypes, the compiler will assume that those functions return values of type int instead of values of type double.
This User Gave Thanks to Don Cragun For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how to round a value

Hello, In a unix shell script,i want to round a variabele to a nearest number Ex: set count=104.4 How can i round that to 105.? Thanks, Sateesh (2 Replies)
Discussion started by: kotasateesh
2 Replies

2. Shell Programming and Scripting

round in KSH

Is there an easy way to round a number up in Korn shell? ie. 10.4 --> 11 Thanks. (6 Replies)
Discussion started by: here2learn
6 Replies

3. Shell Programming and Scripting

round a number

In a shell script - How do I round a decimal number (contained in a variable) to the nearest whole number? (2 Replies)
Discussion started by: achieve
2 Replies

4. Shell Programming and Scripting

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) =... (1 Reply)
Discussion started by: user_prady
1 Replies

5. Shell Programming and Scripting

Round the column value :

Hi .... Iam having the file ....in which 3rd column is numerical having 8 decimal part... i want that to cut to 2 decimal part ... Source File : E100|0|19940.10104030|0|1ABC E103|1|19942.10195849|3|0ABC E100|0|19943.10284858|0|1ABC I want to be ...... Reulst: ... (4 Replies)
Discussion started by: satyam_sat
4 Replies

6. Shell Programming and Scripting

Round with awk

Hi, I have a problem. Basically I dont know how to use awk. I have a script (below) which works fine. What I want to do is somehow "pipe" in the input say 4.5 and have it give the anwer, I dont want ot have to type it in, since it will be running in a script. Any ideas how to do this???? ... (1 Reply)
Discussion started by: AnnaLynn
1 Replies

7. Shell Programming and Scripting

Round off the a Decimal value.

HI, I have a script which is used to calculate the Memory & CPU utilization a server. memx=`ssh -l siebel1 ${f} /usr/sbin/prtconf|grep -i 'Memory size'|tr -s " "|/usr/xpg4/bin/awk -F" " '{print $3 * 1024}'` v5=`ssh -l siebel1 ${f} vmstat 1 2 | tail -1 | tr -s " " | /usr/xpg4/bin/awk -v... (3 Replies)
Discussion started by: dear_abhi2007
3 Replies

8. Shell Programming and Scripting

How to round up on fives in unix?

i'm a newbie here, i need help with a shell script. for a given number, if it is greater than ten round to the nearest 10 same for 100, if it is greater than 100 round to the nearest 100, and same for 1000. i'm confused how to start this... its supposed to look like this input ... (11 Replies)
Discussion started by: CRAZYLITTLELOU
11 Replies

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

10. Shell Programming and Scripting

Round up the decimals

Hi All, I would like to do the following in the shell script 561.76 to 562 I tried using this echo 'scale=0; 749 * 75 /100 ' | bc but just returned only 561 Please help me . I appreciate your help Thanks rajeevm (13 Replies)
Discussion started by: rajeevm
13 Replies
INTERCAL::ByteCode(3pm) 				User Contributed Perl Documentation				   INTERCAL::ByteCode(3pm)

TITLE
Language::INTERCAL::Bytecode - intermediate language DESCRIPTION
The CLC-INTERCAL compiler works by producing bytecode from the program source; this bytecode can be interpreted to execute the program immediately; alternatively, a backend can produce something else from the bytecode, for example C or Perl source code which can then be compiled to your computer's native object format. The compiler itself is just some more bytecode. Thus, to produce the compiler you need a compiler compiler, and to produce that you need a compiler compiler compiler; to produce the latter you would need a compiler compiler compiler compiler, and so on to infinity. To simplify the programmer's life (eh?), the compiler compiler is able to compile itself, and is therefore identical to the compiler compiler compiler (etcetera). The programmer can start the process because a pre-compiled compiler compiler, in the form of bytecode, is provided with the CLC-INTERCAL distribution; this compiler compiler then is able to compile all other compilers, as well as to rebuild itself if need be. See the online manual or the HTML documentation included with the distribution for more information about this. SEE ALSO
A qualified psychiatrist AUTHOR
Claudio Calvelli - intercal (whirlpool) sdf.lonestar.org (Please include the word INTERLEAVING in the subject when emailing that address, or the email may be ignored) perl v5.8.8 2008-03-29 INTERCAL::ByteCode(3pm)
All times are GMT -4. The time now is 05:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy