• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

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 ]
 
I do some of my very best work in water. Like this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic