ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Common Board

Java. How to output real numbers with some digits after decimal point(-)
Posted by Sergey Lazarev (MSU Tashkent) 25 Aug 2009 20:43
Re: Java. How to output real numbers with some digits after decimal point(-)
Posted by Alex Tolstov (Vologda STU) 25 Aug 2009 21:32
PrintWriter out = new PrintWriter(System.out);
out.printf(Locale.US, "%.9f", 2.0/5.0);

this code prints real value with 9 digits after decimal point. but it is a slow method if you want to output more than 10000 real numbers.
Re: Java. How to output real numbers with some digits after decimal point(-)
Posted by Sergey Lazarev (MSU Tashkent) 25 Aug 2009 21:55
Thank you!