the trailboss abuses his CodeRanch power for his other stuff (power corrupts. absolute power corrupts absolutely is kinda neat!)
permaculture light bulbs permaculture electric heat permaculture cast iron permaculture wood burning stove permaculture solar food dehydrators
The moose likes Meaningless Drivel and the fly likes The March of Progress Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Other » Meaningless Drivel
Bookmark "The March of Progress" Watch "The March of Progress" New topic
Author

The March of Progress

Sonny Gill
Ranch Hand

Joined: Feb 02, 2002
Posts: 1211

The March of Progress

1980: C
printf("%10.2f", x);
1988: C++
cout << setw(10) << setprecision(2) << showpoint << x;
1996: Java

java.text.NumberFormat formatter = java.text.NumberFormat.getNumberInstance(); formatter.setMinimumFractionDigits(2); formatter.setMaximumFractionDigits(2); String s = formatter.format(x); for (int i = s.length(); i < 10; i++) System.out.print(' '); System.out.print(s);

2004: Java

System.out.printf("%10.2f", x);



- by Cay Horstmann


The future is here. It's just not evenly distributed yet. - William Gibson
Consultant @ Xebia. Sonny Gill Tweets
 
permaculture playing cards
 
subject: The March of Progress