04-18-2018
@Don Cragun..
You were right.!
the math.h was not visible which was causing conversion issues.
It works fine now.
Thanks.!
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
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
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
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
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
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
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
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
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
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
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
LEARN ABOUT SUSE
constants
math::constants(n) Tcl Math Library math::constants(n)
__________________________________________________________________________________________________________________________________________________
NAME
math::constants - Mathematical and numerical constants
SYNOPSIS
package require Tcl ?8.3?
package require math::constants ?1.0.1?
::math::constants::constants args
::math::constants::print-constants args
_________________________________________________________________
DESCRIPTION
This package defines some common mathematical and numerical constants. By using the package you get consistent values for numbers like pi
and ln(10).
It defines two commands:
o One for importing the constants
o One for reporting which constants are defined and what values they actually have.
The motivation for this package is that quite often, with (mathematical) computations, you need a good approximation to, say, the ratio of
degrees to radians. You can, of course, define this like:
variable radtodeg [expr {180.0/(4.0*atan(1.0))}]
and use the variable radtodeg whenever you need the conversion.
This has two drawbacks:
o You need to remember the proper formula or value and that is error-prone.
o Especially with the use of mathematical functions like atan you assume that they have been accurately implemented. This is seldom or
never the case and for each platform you can get subtle differences.
Here is the way you can do it with the math::constants package:
package require math::constants
::math::constants::constants radtodeg degtorad
which creates two variables, radtodeg and (its reciprocal) degtorad in the calling namespace.
Constants that have been defined (their values are mostly taken from mathematical tables with more precision than usually can be handled)
include:
o basic constants like pi, e, gamma (Euler's constant)
o derived values like ln(10) and sqrt(2)
o purely numerical values such as 1/3 that are included for convenience and for the fact that certain seemingly trivial computations
like:
set value [expr {3.0*$onethird}]
give exactly the value you expect (if IEEE arithmetic is available).
PROCEDURES
The package defines the following public procedures:
::math::constants::constants args
Import the constants whose names are given as arguments
::math::constants::print-constants args
Print the constants whose names are given as arguments on the screen (name, value and description) or, if no arguments are given,
print all defined constants. This is mainly a convenience procedure.
BUGS, IDEAS, FEEDBACK
This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category math ::
constants of the Tcllib SF Trackers [http://sourceforge.net/tracker/?group_id=12883]. Please also report any ideas for enhancements you
may have for either package and/or documentation.
KEYWORDS
constants, degrees, e, math, pi, radians
COPYRIGHT
Copyright (c) 2004 Arjen Markus <arjenmarkus@users.sourceforge.net>
math 1.0.1 math::constants(n)