• Post Reply Bookmark Topic Watch Topic
  • New Topic

converting decimal to fracational  RSS feed

 
Peter Benda
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is there a ready made method in java that i convert decimal to fractional.
for example 2.4 => 12 / 5
 
praveen kumaar
Ranch Hand
Posts: 461
22
Android Chrome Eclipse IDE Google App Engine Java Notepad Oracle Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No!
but you can design your own. do use of greatest common divisor. write your own method.
 
Campbell Ritchie
Marshal
Posts: 56570
172
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unless you use a BigDecimal object, 2.4 ≠ 12 ÷ 5.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!