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.
    http://www.basic4ppc.com/forum/showthread.php?t=1048

    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
    Klaus
    Switzerland
     
  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
    different.
     
  4. klaus

    klaus Expert Licensed User

    Thank you for your answers, it's good to know that both functions work differently.
    Klaus
     
Loading...