Go Back   Forum - BIRT Exchange > Designing BIRT Reports Forums > Designing BIRT Reports

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-01-2009, 02:18 PM
Junior Member
 
Join Date: Jun 2009
Posts: 18
Default Round to 2 decimal places

Hi
I am having issues with rounding a number. I am unable to round a number to (for example) the 2nd decimal......10.666666should be 10.67
I found Math.round but it gives me the nearest integer....11

Please help me in solving this.

Thanks,
Raj.
Reply With Quote
  #2 (permalink)  
Old 07-02-2009, 02:32 AM
Junior Member
 
Join Date: Jun 2009
Posts: 14
Default

did you try like this

Math.round(val*Math.pow(10,dec))/Math.pow(10,dec)

where "dec" is the for precision ie. the number of decimal places you want and "val" is the original decimal value .
Reply With Quote
  #3 (permalink)  
Old 07-02-2009, 07:26 AM
Junior Member
 
Join Date: Jun 2009
Posts: 18
Default

Thanks very much. That solution worked out for me.
Reply With Quote
Reply


Thread Tools
Display Modes




All times are GMT -7. The time now is 01:28 AM.
Powered by vBulletin Copyright © 2000-2010 Jelsoft Enterprises Limited.


Content Relevant URLs by vBSEO 3.1.0