Rounding up to the nearest 0.05

Hi guys i am trying to round a value up to the nearest 0.05. e.g. the value 94.63 would be rounded up as 94.65
I have used big decimal with the round half up and round up modes but it still outputs 94.63
How can I get arround this ?
Cheers

      * Returns the value rounded up to the nearest 0.05
      * @param  double  value to be rounded
      * @return double  rounded up value
     private static double roundOff(double value)
          return Math.ceil(value / ROUNDUP_FACTOR) * ROUNDUP_FACTOR;
     }Where ROUNDUP_FACTOR = 0.05
Edited by: fatjack on Dec 20, 2007 6:05 AM

Similar Messages

  • Formulae - rounding down to the nearest five

    I am new to JAVA programming and not (yet) a brilliant mathematician. Can anybody tell me an algebra formula for rounding down to the nearest 5 (in 100)? Thanks in advance [email protected]

    Your question is not very clear.
    Still I think this would help
    //begin
    int remainder = number % 5 ;
    //We get the remainder
    number = number - remainder;
    //Trim down to the lower value
    if (remainder >= 3){
    number = number + 5 ;
    //If the remainder is 3 or more we should round to the higher value
    //End of block
    Hope this helps
    Shubhrajit

  • How to round numbers to the nearest .25

    I would like to enter a number in one field and have it rounded to the nearest .25 in another column - (whether that's rounding up or down)
    Example:
    Actual Size
    Adjusted Size
    7.21435
    7.25
    Any help would be appreciated.
    Thanks!

    Hi c,
    The ROUND function limits the precision choices to powers of 10, so we need to work within that limitation:
    Multiply by four, round to the nearer whole number, divide by four.
    Formula in column B: =ROUND(A*4,0)/4
    All cells in B are formatted as Number, with decimal places set to 2.
    Regards,
    Barry

  • SQL for rounding to the nearest value

    Hi All,
    My Oracle DB version is 10g Release2 and also 11gR1
    I have data like below, I need to write a SQL for the below requirement.
    ID   RANGE_LOW                RANGE_HIGH
    1      50                    55             
    2      55                    60
    3      60                    63 
    4      63                    77 
    5      77                    84   The requirement is like I need to check a value between the above range low and high then round it to the nearest value.
    Say, for example if I have 68 then the value is rounded to 63 else if 74 then 77 else if its in the middle of two values (70) then rounded to the highest value, here its 77.
    Please advice.

    Ashu_Neo wrote:
    hi Purvesh,
    I think , you didn't check it properly with requirement of posting. Your query needs to be changed a bit. Please verify againYes, I probably missed or overlooked the last line.
    Here is the updated solution then:
    with data as
      select 1 id, 50 low, 55 high from dual union all
      select 2, 55, 60 from dual union all
      select 3, 60, 63 from dual union all
      select 4, 63, 77 from dual union all
      select 5, 77, 84 from dual 
    chk_val as
      select &val val from dual
    select id, low, high,
           val input_value,
           case
            when val < (low + high)/2
              then low
            else
              high
           end round_value
      from data, chk_val
    where val between low and high;
    ID                     LOW                    HIGH                   INPUT_VALUE            ROUND_VALUE           
    4                      63                     77                     70                     77

  • Rounding down using the floor function

    I need some help rounding down to the nearest 5 using the floor function.
    My code appears to be correct but I'm not getting the wrong result.
    create or replace
    TRIGGER "SALE_CALC" BEFORE
    INSERT OR
    UPDATE ON Prs FOR EACH Row
    BEGIN
    :New.Prsvf9c := (floor((:New.Prsprsc - :new.prsvf1c)/5)*5);
    END;
    *:New.Prsprsc = 100.00 and :new.prsvf1c = 46.00*
    After the trigger executes I get a result of *54.00*, which is the result before the rounding should take place. The result should be *50.00!*
    What am I doing wrong?

    The code you posted appears to produce the results you expect if the data is what you say it is
    SQL> create table prs(
      2    Prsvf9c number,
      3    Prsprsc number,
      4    prsvf1c number
      5  );
    Table created.
    SQL> create or replace
      2  TRIGGER "SALE_CALC" BEFORE
      3  INSERT OR
      4  UPDATE ON Prs FOR EACH Row
      5  BEGIN
      6
      7  :New.Prsvf9c := (floor((:New.Prsprsc - :new.prsvf1c)/5)*5);
      8
      9  END;
    10  /
    Trigger created.
    SQL> insert into prs( Prsprsc , prsvf1c )
      2    values( 100, 46 );
    1 row created.
    SQL> select * from prs;
       PRSVF9C    PRSPRSC    PRSVF1C
            50        100         46If you're seeing something different, it would be very helpful if you did something like I did here and post a reproducible test case.
    Incidentally, I'm not sure why you would have columns named prsvf1c and Prsvf9c but if that implies that you've denormalized your table to store 9 values rather than creating a child table with up to 9 rows, that's unlikely to be a reasonable solution.
    Justin

  • Rounding of Qty to the nearest whole no in PO

    Hi All,
    We have material whose base unit of measure is say centimetres. and it has purchase unit as metres.
    Our requirment for procurement is generated through MRP run which creates the Purchase requistion and in PR the UOM considered is the base unit of measure  ie centimetres.
    When this Purchase req is converted to Purchase Orders we get qty sometimes in decimals  for ex: if in Pur req the qty is 150 centimetres , in PO it is shown as 1.5 metres.
    Is there a way for rounding of 1.5 to 2.0 metres in PO (means to the nearest whole no) automatically.
    Thanks,
    Vengal

    in MRP view of material master you have two fields to care about rounding. rounding profile and rounding value
    http://help.sap.com/saphelp_46c/helpdata/en/f4/7d28c844af11d182b40000e829fbfe/content.htm

  • Rounding to the nearest thousand

    hi
    does anybody know how to ceil and floor an integer to the nearest thousand?
    thanks in advance?

    hi friend,
    try this code, it may help you.....
    public class NT {
        /** Creates a new instance of NT */
        public NT() {
        public int roundByThousands(int val)
            int retval=0;
            for(int i=0;i<val;i=i+1000)
                int k=val-i;
                if(k<1000)
                    if(k<=500)
                        retval=val-k;
                    else
                        retval=(1000-k)+val;
            return retval;
        public static void main(String args[])
            NT nt=new NT();
            System.out.println(nt.roundByThousands(11502));
    }

  • Rounding stroke thickness to nearest decimal?

    I have a project where many objects have been scaled up and down during the creation of the artwork. And I'm left with some lines that are .9581 pts and some that are 1.039 pts.
    Just because I'm a neat freak, is there a script that would round the stroke thickness to the nearest .1 decimal? Or whole number? Or user selectable amount of decimals?

    Navarro Parker,
    loop through your path items of selection. This is simple, if only path items in your selection exists:
    // StrokeThicknessRoundingNearestDecimal.jsx
    // required: one or more selected stroked pathItem(s)
    // Rounding stroke thickness to nearest decimal
    // https://forums.adobe.com/message/6764907#6764907
    // regards pixxxelschubser
    var sel = app.activeDocument.selection;
    for (i=0; i < sel.length; i++) {
    if (sel[i].stroked == true) {
        sel[i].strokeWidth = Math.round(sel[i].strokeWidth*10)/10;
    But much more complicated, if there are compound paths or e.g. grouped paths or nested grouped grouped … paths and not possible for strokes which are added in the appearance palette.
    Have fun

  • Rounding float value to nearest 0.05

    Hi,
    can you tell me if there is a convenient way to round off a float ot double to nearest 0.05.
    Example: 18.93 -->18.95 and 18.92 --> 18.90

    Yes. Multiply it by 20. Round to the nearest integer. Divide by 20.

  • Find average of 3 boxes to the nearest 0.50 inch.

    I am working on a PDF. I am trying to get the average of 3 numbers to the nearest 0.50 inch.
    So if the measurements were 16, 15, and 15 it would give the number 15.5 instead of giving the 15.33 since it is closer to 15.5 then 15.0
    Can someone help me with this problem?

    I have never done anything with Javascript before. So the values I am putting into the PDF are in field Neck1, Neck2, and Neck3. I want the average values in these 3 boxes to be put into field AvgNeck but rounded to the nearest 0.50 inch. I have tried to put your code in but I do not know how to get it to work since I don't understand how to get it to use the values I put into the fields and then get it to display. Please bare with me. I have tried to search online to see if I could figure out how to take your code and make it use my fields but i'm not currently understanding.

  • Needed to round a number to nearest thousand

    Hi all,
    Can any one say is there any function to round a number to nearest thousand.
    example == 73882 it must be rounded to 74000.
    Thanks
    Ravi
    use small case when you are posting the questions
    Edited by: Vijay Babu Dudla on Dec 15, 2008 12:09 PM

    Hi
    try this:
    DATA: V_IN TYPE I VALUE 73882,
          V_OUT TYPE I.
    DATA: V_1  TYPE I.
    V_1 = V_IN DIV 1000 + 1.
    V_OUT = V_1 * 1000.
    WRITE V_OUT.
    or
    DATA: V_IN TYPE I VALUE 73882,
          V_OUT TYPE I.
    DATA: V_1  TYPE I,
          V_2  TYPE I.
    DATA: V_DELTA1 TYPE I,
          V_DELTA2 TYPE I.
    V_1 = V_IN DIV 1000.
    V_DELTA1 = ABS( V_1 * 1000 - V_IN ).
    V_2 = V_1 + 1.
    V_DELTA2 = V_2 * 1000 - V_IN.
    IF V_DELTA1 < V_DELTA2.
      V_OUT = V_1 * 1000.
    ELSE.
      V_OUT = V_2 * 1000.
    ENDIF.
    WRITE V_OUT.
    Max

  • Is there a way of moving/quantizing multiple audio regions at once to the nearest bar/beat/division?

    Hi,
    I'm having trouble finding a solution which I hope turns out to be fairly simple. Here's my problem:
    I often make drum beats from audio files that looks something like this:
    What I'd like to know is if there is a way to highlight say all of the snare audio regions and snap or quantize the "audio region start" to the nearest beat or division. I've been looking everywhere and I just can't seem to find a way to do it to multiple regions at once. It seems like somehting that should maybe be fairly simple. Turning "Flex" on doesn't work as that quantizes the transients as opposed to just the start of each audio region.
    The reason I ask is that sometimes when zooming in fully, it turns out some of the regions are not exactly on the grid line.
    I hope I made sense there and I'd appreciate any help. Many thanks in advance.

    Hi
    The "traditional" way to quantise audio regions is to use the quantise functionality in the Event List.
    CCT

  • How do I dispute a copyright claim against a video i made using a trailer in iMovie? The only content I used was the video I shot of friends daughter on a merry-go-round.IMovie had the music etc that I used.

    How do I dispute a copyright claim against a video i made using a trailer in iMovie? The only content I used was the video I shot of friends daughter on a merry-go-round.IMovie had the music etc that I used. Here's the message It gives a number of options to choose from if I want to dispute the claim but I don't know which one this would come under. Several obviously don't apply and of the ones left I don't know which content that is in IMovie that I use comes under. "This video is my original content and I own the rights to it" "I have a license or written permission of the property rights holder to use this material" "My use of the content meets the legal requirements for fair use of fair dealing under applicable copyright laws" or "The content is in the public domain or is not eligible for copright protection."

    You want to use the "I have a license..." option, since clearly the music is not yours, but Apple has granted you a license.
    For your license, see this document, section 2.M. http://images.apple.com/legal/sla/docs/iMovie.pdf
    For more on this irritating problem and why it is so hard to solve, see this article. (It is a problem for Final Cut Pro users as well.)
    http://www.larryjordan.biz/app_bin/wordpress/archives/1842

  • Quick selection tool doesn't snap to to the nearest area. Working more like a lasso tool and the add layer button doesn't seem to creat the cutout that it should.

    Quick selection tool in elements 13 doesn't snap to the nearest border area of the photo. Works more like a lasso. Also the add layer button when clicked on only brings up a black layer, not a black mask with a hole where I just cut.

    Which OS are you working on?
    Please try resetting your tools from Photo Bin flyout menu.
    1. Open Photo bin.
    2. Click on Fly Out menu
    3. Click on option Reset all Tools
    4. Relaunch Editor13
    and see if it helps.
    Thanks,
    Anwesha

  • After i pulled a screen protector off my new ipad there were what look like small round bubbles on the actual screen. They do not go away.The protector was an Ikit one.

    After I pulled a screen protector off my new ipad I found round spots on the actual screen of the ipad which will not go away. The protector was an IKIT one.

    It's probably just dried solution from the application of the screen protector.  You can get some safe cleaning solutions for your iPad screen.  there's iClean, Monster has an iPad safe solution........

Maybe you are looking for

  • Code Generation code4flex

    Hello, I want to present a Code Generation Tool of Knowledgeit.com.ar The tool is Code4Flex now is in Alpha stage knowledgeit Is an open source tool for integration between AmfPhp and Flex. It starts with a MySql DB and ends with 2 proyects: Php Proj

  • EJB Local Interfaces / javax.naming.NamingException

    Hi! I have tried to deploy a very simple (Hello World like)EJB-Application. It contains a simple stateless SessionBean (with local interfaces) and a JSP which is using the EJB. Opening the JSP i get the following error message: javax.naming.NamingExc

  • How does columnSpan work? [JS][CC2014]

    Some background info: I'm using InDesign CC 2014 latest version I have a simple table set up: 6 columns by 5 rows I want to check if the first cell in the first row is merged, and if it isn't merged, merge the first 4 columns of the first row. So I w

  • Preview Delay in capturing video -- How to eliminate it?

    Hi, I am trying to do the following: -- record video from an external camera (we are in an infant psychology lab, so our videos are all of cute little babies watching toys, playing with them, or listening to sounds) -- but at the same time, check on

  • Hard Drive not being recognised in BIOS - Equium A60

    Hi hope someone can help. I have a Toshiba Equium EA60-173 and the hard drive is not being recognised in the BIOS. When I take the hard drive out and put it in another laptop it is detected fine. I have also tried another hard drive in the Toshiba an