Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2008
    Location
    India
    Posts
    96

    Unanswered: difference between 7 and 7.00

    Hi All,

    I have two set of statement.

    select (((1+7.00/100)*(1+8.00/100)*(1+5.00/100))-1)*100

    select (((1+7/100)*(1+8/100)*(1+5/100))-1)*100


    if i execute the first one, it is giving

    21.338000000000000000

    if i execute the second one, it is giving

    0

    why? I think there is some difference between int and float calculation. But i am not sure...

    Inputs are welcome!

    / (Divide)

    is it applicable to sybase too?

  2. #2
    Join Date
    May 2005
    Location
    South Africa
    Posts
    1,365
    Provided Answers: 1
    Integer calculations truncate the decimal portion (not just Sybase specific)
    i.e. 7/100=0
    By specifying 7.00/100 you force decimal calculations
    7E0/100 will force float calculations

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •