This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help in Float comparison

 
Anusha Jv
Greenhorn
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I have two String(TextField value) which take floating point value.
I want to compare them by rounding.
Please tell the way to do it.
Thanks
 
Michael Fitzmaurice
Ranch Hand
Posts: 168
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
First you need to convert the Strings to floats - use <code>Float.parseFloat()</code>. Then you need to round the 2 resulting floats to ints - use <code>Math.round()</code> on them both. Then do simple int comparison to find out what you need to know.
Hope this helps
 
Anusha Jv
Greenhorn
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks It works fine.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic