Hello everyone,
I am comparing two floating point numbers by storing them in seperate files and then using difference command to verify,it is working fine.
But I want to compare two values which will come at 4 precision places.
My requiremnet is
file1
The source file will come at 4 precision values (file1).if the value is 123.42 it will not display as 123.4200 and 123.4 will not be 123.4000 and 0 will not come in as 0.0000
I Need to display it padding with 0's at the end until it becomes 4 precision points .I have searched in this forum for answers before posting, my requirement is based on input,
I need to pad 0's so that i can compare it with file2
ex:
0 should be 0.0000
1.2 should be 1.2000
-5.023 should be -5.0230
6.2345 should be 6.5345
Could you please help me
I am comparing two floating point numbers by storing them in seperate files and then using difference command to verify,it is working fine.
But I want to compare two values which will come at 4 precision places.
Code:
ex:
file1
Date,Count,Checksum
01/31/2014,3702,-170552450514.86
command:
cat $trigger_file | sed '1d' | tr -s ' ' | cut -d, -f3 > trigger_file.txt
-170552450514.86
file2
sed '1d' ${data_file} | cut -d',' -f7 | awk '{s+=$1}END{ printf("%.4f\n",s)}' > data_file.txt
-170552450514.8600
file1
The source file will come at 4 precision values (file1).if the value is 123.42 it will not display as 123.4200 and 123.4 will not be 123.4000 and 0 will not come in as 0.0000
I Need to display it padding with 0's at the end until it becomes 4 precision points .I have searched in this forum for answers before posting, my requirement is based on input,
I need to pad 0's so that i can compare it with file2
ex:
0 should be 0.0000
1.2 should be 1.2000
-5.023 should be -5.0230
6.2345 should be 6.5345
Could you please help me