10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi Everyone ,
Need a simple code here , I Have a number in a variable say $a=145.67 . This value changes everytime loop begins .
I need to print a specific message as shown below when the above variable lies in a specific range i.e.
1.if $a lies within 100 and 200 , it should display... (2 Replies)
Discussion started by: robert89
2 Replies
2. Shell Programming and Scripting
I have started using bash but this script which I am working on it, is in c chell. So here is my simple problem:
set x = 0.4124\0.234
echo $x
0.4124.0.234
Same operation in Bash gives me correct result in my terminal. So there is something with my c shell that is causing this behaviour.... (8 Replies)
Discussion started by: dixits
8 Replies
3. Shell Programming and Scripting
Hi all,
I'm struggling :wall: to make a an if statement on two variables in scientific format.
e.g.
a=1.23e+01
b=3.21e+02
I know that it can be done with bc if the variable are not in scientific format.
But what to do in this case???
Thank you, (3 Replies)
Discussion started by: f_o_555
3 Replies
4. Shell Programming and Scripting
I need to add leading zeros in a floating point numbers.
The length of the number should be 13 including decimal.
The input number is changing so number of leading zeros is not fix.
For example
input output
216.000 000000216.000
1345.000 000001345.000
22345.500 ... (4 Replies)
Discussion started by: reeta_shri
4 Replies
5. Programming
Anyone help me i cant found the error of floating point
if needed, i added the code complete
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
typedef struct
{
int hh;
int mm;
int ss;
char nom;
int punt;
}cancion;
typedef struct... (9 Replies)
Discussion started by: Slasho
9 Replies
6. Shell Programming and Scripting
Hi I'm not using Korn93 but want to use floating point variable.
Is there any solution to do that ?
thx for help.
---------- Post updated at 02:28 PM ---------- Previous update was at 12:38 PM ----------
I have the following peace of code:
for n in `cat log.January.1.array`
do
... (3 Replies)
Discussion started by: presul
3 Replies
7. Shell Programming and Scripting
Hi !
I'm looking for a way to transform certain floating point numbers in a one-line, variable length file to integers.
I can do this in a crude way with sed :
sed -e 's/0\.\(\):/\1:/g' -e 's/0\.0\(\):/\1:/g' -e 's/1\.000:/100:/g' myfile ... but this doesn't handle the rounding correctly.
... (3 Replies)
Discussion started by: jossojjos
3 Replies
8. Shell Programming and Scripting
How can we compare 2 floating point numbers in SHELL script? (11 Replies)
Discussion started by: dearanik
11 Replies
9. Programming
Hi,
see the simple code below
double i;
i=8080.9940;
printf(" val :%.30f\n",i);
output i m getting is
val :8080.993999999999700000000000000
when i m expecting
val :8080.9940
what happens?how can i avoid it?
thanks... (2 Replies)
Discussion started by: Hara
2 Replies
10. Shell Programming and Scripting
HI all,
Can someone help me how to use or assign a floating point value in a variable in a unix script. I dont know how to use it.
for example, I am to assign a variable VAR1 a value of 2.34 and evaluate if a certain vaue is greater or less than to it.
That is,
if var1 > 2.13 will do... (7 Replies)
Discussion started by: darry
7 Replies