• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Formatting a Number ??

 
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Eric,
I want to write a java function which will format a number upto four digit after decimal and if the number in fifth position after decimal is greater than and equal 5 then it should add 1 with fourth position number and if that number is smaller than 5 than it should trim the rest number after four digit after decimal.Can you please give me some idea how i can do that.
Thanks & Regards
Bikash
[ March 16, 2004: Message edited by: Bikash Paul ]
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The following link shows how I did it for 2 decimal places, I am sure you can figure out how to make it work for 4.
https://coderanch.com/t/114331/HTML-JavaScript/simple-pl-help
If you need help just yell and I can guide you through it
Eric
[ March 16, 2004: Message edited by: Eric Pascarello ]
 
You can thank my dental hygienist for my untimely aliveness. So tiny:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic