on 10-16-2008 2:06 PM
Hi experts,
i designed a simple UDF that sums all the value of a segment.
The problem is that in my output I tend to get like 10 decimals!!
Is that normal ? How can I manage to get the value I want??
For example, in my segments I have the following values:
21.00, 15.00, 16.90
as result I get 52.9 which is OK
but when I have 21.00, 15.00, 16.90
the result I get is
52.989999999999995 !!??
How come?my code is the following:
public static void add_all_zvalnet(String[] ZVALNET,ResultList result,Container container){
double sum = 0;
for (int i = 0; i < ZVALNET.length; i++){
sum = sum + Double.parseDouble(ZVALNET<i>);
}
result.addValue(""+sum);
}
thx for your help
kind regards,
Jamal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thanks, ill take a look at that.
and sorry i meant 16.99 in the second example
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
10 | |
7 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.