double returning only one precision in java

Posted by srinath on Stack Overflow See other posts from Stack Overflow or by srinath
Published on 2012-12-16T17:01:36Z Indexed on 2012/12/16 17:03 UTC
Read the original article Hit count: 163

Filed under:

in my code i am performing division on numbers and storing it in a double variable. but the variable is returning with only one precision. i want to increase the precision how could i do that.

double x;
        for ( int i =0 ; i<10000 ; i++)
        {

            x= w[i] / l[i];
            System.out.println(x);
        }

in the above code w and l are integer arrays;

i am getting output like

3.0
0.0
1.0
0.0

i want to increase the precision upto 4 atleast.

© Stack Overflow or respective owner

Related posts about java