Round function

Discussion in 'Questions (Windows Mobile)' started by klaus, Nov 15, 2007.

  1. klaus

    klaus Expert Licensed User

    Hello Erel
    In the german forum Bobbes asked some help about the Round function and got an answer from specci48.

    In his answer I wondered that the Round function works like
    if > 5 then round up
    else round down
    Round(4.5,0) > 4

    in my mind it should work like
    if>=5 then round up
    else round down
    Round(4.5,0) > 5

    as it does with the Format function.

    I tried it in VisualBaisc it's the same.

    Is there any reason for this behaviour.
    I have joined a small example to show the difference.

    Best regards
  2. Erel

    Erel Administrator Staff Member Licensed User

    Basic4ppc uses the .Net Framework Round function.
    Here is a quote from .Net documentation that explains this behavior:
  3. Henry

    Henry Member Licensed User

    Good to know :)

    Klaus, Round and Format are function for different purposes - it's ok that they work
  4. klaus

    klaus Expert Licensed User

    Thank you for your answers, it's good to know that both functions work differently.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice