on 09-14-2009 2:21 PM
Hi Experts,
In my scenerio i'm obtaining the division values i need to round those values.
In breief,If I'm getting the division value 0.194205 i shoud round it to 0.19421.How can i do this? I have also tried with inbuilt function round but it is rounding the value to integer.
hi
Try with function FormatNum.... 000.00000
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi.
It would better don't use Float is better use Bigdecimal.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
you can achieve this by writing a UDF, in which you can mention the number of decimals you need. for this you need to import
import java.text.NumberFormat;
float f =Float.parseFloat(a);
NumberFormat num = NumberFormat.getNumberInstance();
num.setMaximumFractionDigits(5);
String str = num.format(i);
return str;
in the above code a is the input argument,
5 is the number of places after the decimal.
Regards
Venkat
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Divya,
Try this code.
input = String representation of 0.194205
Double dInput = new Double (input);
double d = dInput.doubleValue();
DecimalFormat twoDForm = new DecimalFormat("#.#####");
return Double.valueOf(twoDForm.format(d));
Regards
Suraj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
Build in function will not support ,
Try with the UDF
Regards,
Jude
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.