Sponsored Content
Top Forums Shell Programming and Scripting Script shell, how to calculate percentage? Post 302544626 by neutronscott on Thursday 4th of August 2011 10:29:06 AM
Old 08-04-2011
math is with integers. multiply first by 100.
Code:
$((100*jj/kk))

 

10 More Discussions You Might Find Interesting

1. Programming

how do I calculate percentage ?

int percent (int a, int b) { if (b/a*100 > 25) return TRUE; else return FALSE; } I want to calculate what percentage of a is b. say if b = 48, a = 100 so b is 48% of a but wouldnt b/a give me 0 ??? what can be done ?? (6 Replies)
Discussion started by: the_learner
6 Replies

2. Shell Programming and Scripting

How to calculate the percentage for the values in column

Hi, I am having the file which contains the following two columns. 518 _factorial 256 _main 73 _atol 52 ___do_global_ctors 170 ___main 52 ___do_g How can calculate the percentage of each value in the first column ? first need to get the sum of the first column and... (3 Replies)
Discussion started by: saleru_raja
3 Replies

3. Shell Programming and Scripting

How can i calculate percentage ??

i have 3 files like total.dat=18 equal.dat=14 notequal.dat=16 i need find the equal percentange means: equalpercentage = ($equal.dat / $total.dat * 100) How i can do this ? I tried some of the answers to calculate the percentage in this forums.but it couldn't worked.Some one please... (6 Replies)
Discussion started by: bobprabhu
6 Replies

4. Shell Programming and Scripting

Need an AWK script to calculate the percentage

Hi I need a awk script to calculate percentage. I have to pass the pararmeters in to the awk script and calculate the percentage. Sum = 50 passed = 43 failed = 7 I need to pass these value in to the awk script and calculate the percentage. Please advice me. (8 Replies)
Discussion started by: bobprabhu
8 Replies

5. Shell Programming and Scripting

How to calculate what percentage of X value is there in the file?

Input File: 5081 2058 175 8282 2358 7347 6612 3459 END OF INPUT FILE I need to know how to calculate minimum,maximum,average of the values in the file and also what percentage is the values over some user defined value for example 1000 and what percentage of value is over 5000. By... (2 Replies)
Discussion started by: aroragaurav.84
2 Replies

6. Shell Programming and Scripting

Need an awk script to calculate the percentage of value field and replace

Need an awk script to calculate the percentage of value field and replace I have a input file called file.txt with the following content: john|622.5674603562933|8|br:1;cn:3;fr:1;jp:1;us:2 andy|0.0|12|**:3;br:1;ca:2;de:2;dz:1;fr:2;nl:1 in fourth filed of input file, calulate percentage of each... (1 Reply)
Discussion started by: veeruasu
1 Replies

7. UNIX for Dummies Questions & Answers

Need an awk script to calculate the percentage of value field and replace

I have a input file called file.txt with the following content: john|622.5674603562933|8|br:1;cn:3;fr:1;jp:1;us:2 andy|0.0|12|**:3;br:1;ca:2;de:2;dz:1;fr:2;nl:1 in fourth filed of input file, calulate percentage of each sub filed seperated by ; semicolon and replace value with percentage . i... (11 Replies)
Discussion started by: veeruasu
11 Replies

8. Shell Programming and Scripting

Calculate percentage of a value accross m

I have 100 csv files like: file_city_1 file_city_2 file_city_3 file_city_4 City name is variable, there is 25 cities, each city has 4 region. Each of the 4 region contain some statistics like: parameter1 : number1 parameter1 : number2 ..... parameter50 : number50 ... (7 Replies)
Discussion started by: Meacham12
7 Replies

9. Shell Programming and Scripting

Calculate Percentage

Hello, Ive got a bunch of numbers here e.g: 6065 6094 6348 6297 6161 6377 6338 6290 How do I find out if there is a difference between 10% or more between one of these numbers ? I am trying to do this in Bash.. but no luck so far.. Does anyone have an Idea ?? Thanx, - Pascal... (9 Replies)
Discussion started by: denbekker
9 Replies

10. Shell Programming and Scripting

Calculate percentage difference between two columns

I have a input text file in this format: ITEM1 10.9 20.1 ITEM2 11.6 12 ITEM3 14 15.7 ITEM5 20 50.6 ITEM6 25 23.6 I want to print those lines which have more than 5% difference between second and third columns. (8 Replies)
Discussion started by: ctrld
8 Replies
math::rationalfunctions(n)					       Math						math::rationalfunctions(n)

__________________________________________________________________________________________________________________________________________________

NAME
math::rationalfunctions - Polynomial functions SYNOPSIS
package require Tcl ?8.4? package require math::rationalfunctions ?1.0.1? ::math::rationalfunctions::rationalFunction num den ::math::rationalfunctions::ratioCmd num den ::math::rationalfunctions::evalRatio rational x ::math::rationalfunctions::addRatio ratio1 ratio2 ::math::rationalfunctions::subRatio ratio1 ratio2 ::math::rationalfunctions::multRatio ratio1 ratio2 ::math::rationalfunctions::divRatio ratio1 ratio2 ::math::rationalfunctions::derivPolyn ratio ::math::rationalfunctions::coeffsNumerator ratio ::math::rationalfunctions::coeffsDenominator ratio _________________________________________________________________ DESCRIPTION
This package deals with rational functions of one variable: o the basic arithmetic operations are extended to rational functions o computing the derivatives of these functions o evaluation through a general procedure or via specific procedures) PROCEDURES
The package defines the following public procedures: ::math::rationalfunctions::rationalFunction num den Return an (encoded) list that defines the rational function. A rational function 1 + x^3 f(x) = ------------ 1 + 2x + x^2 can be defined via: set f [::math::rationalfunctions::rationalFunction [list 1 0 0 1] [list 1 2 1]] list num Coefficients of the numerator of the rational function (in ascending order) list den Coefficients of the denominator of the rational function (in ascending order) ::math::rationalfunctions::ratioCmd num den Create a new procedure that evaluates the rational function. The name of the function is automatically generated. Useful if you need to evaluate the function many times, as the procedure consists of a single [expr] command. list num Coefficients of the numerator of the rational function (in ascending order) list den Coefficients of the denominator of the rational function (in ascending order) ::math::rationalfunctions::evalRatio rational x Evaluate the rational function at x. list rational The rational function's definition (as returned by the rationalFunction command). order) float x The coordinate at which to evaluate the function ::math::rationalfunctions::addRatio ratio1 ratio2 Return a new rational function which is the sum of the two others. list ratio1 The first rational function operand list ratio2 The second rational function operand ::math::rationalfunctions::subRatio ratio1 ratio2 Return a new rational function which is the difference of the two others. list ratio1 The first rational function operand list ratio2 The second rational function operand ::math::rationalfunctions::multRatio ratio1 ratio2 Return a new rational function which is the product of the two others. If one of the arguments is a scalar value, the other ratio- nal function is simply scaled. list ratio1 The first rational function operand or a scalar list ratio2 The second rational function operand or a scalar ::math::rationalfunctions::divRatio ratio1 ratio2 Divide the first rational function by the second rational function and return the result. The remainder is dropped list ratio1 The first rational function operand list ratio2 The second rational function operand ::math::rationalfunctions::derivPolyn ratio Differentiate the rational function and return the result. list ratio The rational function to be differentiated ::math::rationalfunctions::coeffsNumerator ratio Return the coefficients of the numerator of the rational function. list ratio The rational function to be examined ::math::rationalfunctions::coeffsDenominator ratio Return the coefficients of the denominator of the rational function. list ratio The rational function to be examined REMARKS ON THE IMPLEMENTATION
The implementation of the rational functions relies on the math::polynomials package. For further remarks see the documentation on that package. BUGS, IDEAS, FEEDBACK This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category math :: rationalfunctions of the Tcllib SF Trackers [http://sourceforge.net/tracker/?group_id=12883]. Please also report any ideas for enhance- ments you may have for either package and/or documentation. KEYWORDS
math, rational functions COPYRIGHT
Copyright (c) 2005 Arjen Markus <arjenmarkus@users.sourceforge.net> math 1.0.1 math::rationalfunctions(n)
All times are GMT -4. The time now is 11:35 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy