08-02-2007
Multiplying Floats/Decimals
Is there a way that i can get something like this to work:
Number=`expr 80 \* 10.69`
i.e. To multiply an integer by a decimal or a decimal by a decimal etc...?
thanks
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi
$ a=10 ; b=2
$ expr $a + $b
12
$ expr $a - $b
8
$ expr $a / $b
5
$ expr $a * $b
expr: syntax error
Any idean why I am getting this error only when multiplying two numbers. Whats the exact syntax?
Thanks a lot to all in advance
CSaha (5 Replies)
Discussion started by: csaha
5 Replies
2. Shell Programming and Scripting
Hi,
I am trying to find if there is a way to convert regular decimal values to Paced decimal values. I tried to find a c program but I could get a Packed converted to regular decimal not the other way round.
If not unix please let me know if any other progrimming language I can use to do... (2 Replies)
Discussion started by: mgirinath
2 Replies
3. Shell Programming and Scripting
(4 Replies)
Discussion started by: puddy
4 Replies
4. Shell Programming and Scripting
Hello. I have a problem with AWK and floats below 0 in a script.
It may be simplified to this line (please, take into account that my "locale" is Spanish, so the system will read "," as decimal separator):
echo -1,25 2,55745 0,33 ,278 | awk '{print $1+1, $2+1, $3+1, $4+1}'... getting:
-0,25... (4 Replies)
Discussion started by: JCastro
4 Replies
5. Shell Programming and Scripting
I am using gawk in a dos shell in windows xp and want to read a datafile and reformat it.
The datafile consists of columns of integers, floating point numbers and text strings. Each column is a fixed width and each column contains the same data type, eg all integers, all text.
I am looking for a... (0 Replies)
Discussion started by: lookingfor help
0 Replies
6. Shell Programming and Scripting
I want to make computations using floats. This cannot be done with csh. ksh seem to have a problem as well. What is good shell for computations without having to resort to bc or awk? How about python? (5 Replies)
Discussion started by: kristinu
5 Replies
7. Programming
Hi, this is my code.It's simple : there are 2 2D arrays and the multiplied to C.
#include<stdio.h>
#include<sys/shm.h>
#include<sys/stat.h>
#include<stdlib.h>
main()
{
int *A; //A
int *B; //B
int *C; //C
int i,j,x,k,d;
int id;
... (17 Replies)
Discussion started by: giampoul
17 Replies
8. Shell Programming and Scripting
I am trying to take all the elements of an array and multiply them by 2, and then copy them to a new array. Here is what I have
i=0
for true in DMGLIST
do
let DMGSIZES2="${DMGSIZES}"*2
let i++
done
unset i
echo ${DMGSIZES2}
It does the calculation correctly for the first element,... (7 Replies)
Discussion started by: nextyoyoma
7 Replies
9. Programming
HI,
i am trying to multiply 2 2D arrays (a,b) using fork.
The answer will be at c.
Each child have to calculate 1 row of c.
The code is right, as i think of it, with no errors but i dont get the correct c array...
I think there is maybe a mistake in i dimension ...
Anyway, here is the code:
... (16 Replies)
Discussion started by: giampoul
16 Replies
10. Programming
I have this script which can calculate the total of numbers given in a string
total = 0
for c in '0123456789':
total += int(c)
print total
How should I modify this script to find the total of if the numbers given in the string form have decimal places? That is, how do I need to modify... (2 Replies)
Discussion started by: faizlo
2 Replies