I am begining to learn bourne shell and as a practice I have written a script which when given the purchase price and percentage of discount calculates the savings.
I somehow cannot figure out why my script fails to do arthimatic calculation on real numbers.
Could anyone look at the script... (5 Replies)
Discussion started by: Tirmazi
5 Replies
3. Post Here to Contact Site Administrators and Moderators
page
unix com/answers-frequently-asked-questions/13785-yesterdays-date-date-arithmetic.html
Date Arithmetic with the Shell
has link of
www samag com/documents/s=8284/sam0307b/0307b.htm
which is no longer.
Is this the correct place to post this?:confused:
and I got message... (1 Reply)
Hello everybody,
I decided to take a Unix Introduction class and have never had experience with programming. Everything was fine until recently when the Prof. started shell scripting and he wants us to make a small script to add unlimited numbers from arguments and from standard input.
I... (1 Reply)
Hello everybody,
I decided to take a Unix Introduction class and have never had experience with programming. Everything was fine until recently when the Prof. started shell scripting and he wants us to make a small script to add unlimited numbers from arguments and from standard input.
I... (8 Replies)
I need help on arithmetic
root@server # hour=`date | awk {'print $4'} | cut -d: -f 1`; echo $hour
04
Now I subtract this result by 1 or 01 I get "3" as the answer. I need "03" as the answer, ie last two significant numbers should be there.
root@server # hour=`date | awk {'print $4'} | cut... (3 Replies)
Hi,
I need a help with arithmetic calculations in my script. I have two variables: a=17; b=1712
I want to perform ($a/$b)*100 with two decimals in the result.
I tried with following:
res=$((100*a/b))
res=`echo "scale=2; $a / $b" | bc`
But I am not getting the decimal values.... (4 Replies)
I am trying to perform arithmetric, for example, to increment the value of variable $a (say 3) by 0.05 but when I tried the following expression
let a=a+0.05
or a=$((a+0.05))
both returned
3.0499999999999998
I want to keep 2 decimal places so it returns 3.05 instead. (6 Replies)
i am having a varialbe a , which is input to my file
i want to multiply this input with value .43, and assign it to variable b.
i tried it as below:
#!/bin/sh
a=$1
b=`expr $1\*0.43`
echo b=$b
error : expr: non-integer argument
Please tell me , how to do this.
Thanks (10 Replies)
Hello,
I am having a problem when i execute following script on RHEL 6.4. Same script works fine on another machine where I have same version of RHEL and KSH.
Below is the rpm and RHEL version.
ossvm12(0)> rpm -qa | grep ksh
ksh-20100621-19.el6.x86_64
ossvm12(0)> cat... (7 Replies)
Discussion started by: Adithya Gokhale
7 Replies
LEARN ABOUT CENTOS
slagv2.f
slagv2.f(3) LAPACK slagv2.f(3)NAME
slagv2.f -
SYNOPSIS
Functions/Subroutines
subroutine slagv2 (A, LDA, B, LDB, ALPHAR, ALPHAI, BETA, CSL, SNL, CSR, SNR)
SLAGV2 computes the Generalized Schur factorization of a real 2-by-2 matrix pencil (A,B) where B is upper triangular.
Function/Subroutine Documentation
subroutine slagv2 (real, dimension( lda, * )A, integerLDA, real, dimension( ldb, * )B, integerLDB, real, dimension( 2 )ALPHAR, real, dimension(
2 )ALPHAI, real, dimension( 2 )BETA, realCSL, realSNL, realCSR, realSNR)
SLAGV2 computes the Generalized Schur factorization of a real 2-by-2 matrix pencil (A,B) where B is upper triangular.
Purpose:
SLAGV2 computes the Generalized Schur factorization of a real 2-by-2
matrix pencil (A,B) where B is upper triangular. This routine
computes orthogonal (rotation) matrices given by CSL, SNL and CSR,
SNR such that
1) if the pencil (A,B) has two real eigenvalues (include 0/0 or 1/0
types), then
[ a11 a12 ] := [ CSL SNL ] [ a11 a12 ] [ CSR -SNR ]
[ 0 a22 ] [ -SNL CSL ] [ a21 a22 ] [ SNR CSR ]
[ b11 b12 ] := [ CSL SNL ] [ b11 b12 ] [ CSR -SNR ]
[ 0 b22 ] [ -SNL CSL ] [ 0 b22 ] [ SNR CSR ],
2) if the pencil (A,B) has a pair of complex conjugate eigenvalues,
then
[ a11 a12 ] := [ CSL SNL ] [ a11 a12 ] [ CSR -SNR ]
[ a21 a22 ] [ -SNL CSL ] [ a21 a22 ] [ SNR CSR ]
[ b11 0 ] := [ CSL SNL ] [ b11 b12 ] [ CSR -SNR ]
[ 0 b22 ] [ -SNL CSL ] [ 0 b22 ] [ SNR CSR ]
where b11 >= b22 > 0.
Parameters:
A
A is REAL array, dimension (LDA, 2)
On entry, the 2 x 2 matrix A.
On exit, A is overwritten by the ``A-part'' of the
generalized Schur form.
LDA
LDA is INTEGER
THe leading dimension of the array A. LDA >= 2.
B
B is REAL array, dimension (LDB, 2)
On entry, the upper triangular 2 x 2 matrix B.
On exit, B is overwritten by the ``B-part'' of the
generalized Schur form.
LDB
LDB is INTEGER
THe leading dimension of the array B. LDB >= 2.
ALPHAR
ALPHAR is REAL array, dimension (2)
ALPHAI
ALPHAI is REAL array, dimension (2)
BETA
BETA is REAL array, dimension (2)
(ALPHAR(k)+i*ALPHAI(k))/BETA(k) are the eigenvalues of the
pencil (A,B), k=1,2, i = sqrt(-1). Note that BETA(k) may
be zero.
CSL
CSL is REAL
The cosine of the left rotation matrix.
SNL
SNL is REAL
The sine of the left rotation matrix.
CSR
CSR is REAL
The cosine of the right rotation matrix.
SNR
SNR is REAL
The sine of the right rotation matrix.
Author:
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date:
September 2012
Contributors:
Mark Fahey, Department of Mathematics, Univ. of Kentucky, USA
Definition at line 157 of file slagv2.f.
Author
Generated automatically by Doxygen for LAPACK from the source code.
Version 3.4.2 Tue Sep 25 2012 slagv2.f(3)