I had a person bring an interesting problem to me that appears to involve some sort of rounding inside awk. I've verified this with awk and nawk on Solaris as well as with gawk 3.1.5 on a Linux box.
The original code fragment he brought me was thus:
What was odd was this would print an index of 1 even though the script should have found "index < 1" false when index==1.
I wrote a little follow on script to highlight this further
I would expect the output of this to print 5 lines, then 6 lines but instead we see 5 lines then 7 lines:
The fact that the change occurs around .5 makes me think we're seeing some sort of integer rounding in action but I don't know how to force a variable to always be interpreted as a float to avoid this -- as best as I can tell awk doesn't support any for of typecasting. In the example you'll see that I always use a floating point value when doing math on the variables but that doesn't seem to affect things one way or another.
Does anyone have a simple way of doing floating point ("fp") division? For example, if I divide 3 by 5, I can get 0.6. The built-in calc (`bc`) will perform fp multiplication, but not division, at least not straight-up (i.e., starting bc and just typing in 3/5).
I am trying to do this using... (1 Reply)
hi all, i have the following problem using awk in a script
i want to read the values from a column with real numbers and calculate the mean.the problem is that when i use a statement such as this
num = $4
i cant find a way to convert the variable from string to floating point to perform... (7 Replies)
hi, :)
I have a file like this
10.456
123.567
456.876
234.987
........
.......
What i want to do is ia have to add all those numbers and put the result in some other file.
Any help pls.
cheers
RRK (8 Replies)
Hi,
I am trying to write a script to extract multiple sets of data from a chemistry output file. The problem section is in the following format...
Geometry "geometry" -> "geometry"
1 Pd 46.0000 -0.19290971 0.00535260 0.02297606
2 P ... (7 Replies)
Hello,
i have some variables say:
x=1.4
y=3.7
I wish to round off these values to :
x = 2 (after rounding off)
y = 4 (after rounding off)
I am stuck.
Please help. (7 Replies)
Hi,
I am compiling "HelloWorld" C progam on 32-bit CentOS and i want to execute it on 64-bit CentOS architecture.
For that i copied the a.out file from 32-bit to 64-bit machine, but while executing a.out file on 64bit machine I am getting "Floating point exception error".
But we can run... (3 Replies)
Hi,
Could any one tell me how to compare to floating point no. using test command. As -eq option works on only intergers.
i=5.4
if
then
echo "equal"
else
echo "not equal"
fi
here output will be equal even though no. are unequal.
Thanks,
ravi (1 Reply)
is it not possible to simply di aritmetic without using bc or awk
i have tried folllowing operatrions but they support only integer types plz suggest me code for floating using values stored in the variables.the ans i get is integer and if i input floating values i get error numeric constant... (6 Replies)
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)
I have a number, which I want to convert into the nearest floating number upto two places after the decimal point.
E.g.
1.2346 will become 1.23
but
1.2356 will become 1.24 .
Similarly
0.009 will be 0.01
and
0.001 will be 0.00 or 0.0 (not 0, wnat to keep the decimal... (1 Reply)
Discussion started by: hbar
1 Replies
LEARN ABOUT DEBIAN
pinot-index
PINOT-INDEX(1) User Commands PINOT-INDEX(1)NAME
pinot-index - Index documents from the command-line
SYNOPSIS
pinot-index [OPTIONS] --db DATABASE URLS
DESCRIPTION
pinot-index - Index documents from the command-line
OPTIONS -b, --backend
name of back-end to use (default xapian)
-c, --check
check whether the given URL is in the index
-d, --db
path to, or name of, index to use (mandatory)
-h, --help
display this help and exit
-i, --index
index the given URL
-s, --showinfo
show information about the document
-v, --version
output version information and exit
Supported back-ends are : 'xapian'
EXAMPLES
pinot-index --check --showinfo --backend xapian --db ~/.pinot/daemon ../Bozo.txt
pinot-index --index --db PinotOnTheWeb http://code.google.com/p/pinot-search/
Indexing documents to My Web Pages or My Documents with pinot-index is not recommended
REPORTING BUGS
Report bugs to fabrice.colin@gmail.com
This is free software. You may redistribute copies of it under the terms of the GNU General Public License
<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>.
There is NO WARRANTY, to the extent permitted by law.
pinot-index - pinot 1.0 June 2012 PINOT-INDEX(1)