I have the following input: 37l07287533902l027987979982208375902465l0l35740250 463769376774900097l2648l248969700780504l70l8260538 74324986l9952474l0594742333095l3058l237266l7309629 9l9422l3363574l6l57252243056330l8ll072406l54908250 23067588207539346l7ll7l9803l042l0475l3778063246676 And I I want to store at least 10 SF to maintain the accuracy. My code: At this point, however, can I change the X twice to maintain accuracy? Thanks :) You can get a if you In fact requires precise value (instead of 10 important points mentioned in the question), then you
BufferedReader br = null; Decimals D = New Decimal Foil ("#"); Try {br = new BufferedReader (new FileReader (file)); } Hold (FileNotFoundException E) {// TODO Auto-generated Cache Block system.out.println (e); } While (br.readline ()! = Null) {string x = d.format (double .pda double (breadline ()); Println (x); }
double Along with accuracy should be able to maintain around 15 important points. You need to catch the value returned by
Double.parseDouble rather than just formatting. You only need to read each row once:
String line; While ((line = br.readline ())! = Null ({double value = double.psrd double (line); // value ...}
BigInteger if they are all integers, or
binary If some values are actually non-integers.
Friday 15 March 2013
java - Accuracy with Double -
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment