Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2003
    Location
    Romania
    Posts
    70

    Question Unanswered: ROUND unexpected result

    /*********** Script 1 **************/
    declare @nr_1 as decimal (10,2)
    declare @nr_2 as decimal (10,2)
    set @nr_1=5
    set @nr_2=3
    select round(@nr_1/@nr_2,0)

    RESULT = 2

    /*********** Script 2 **************/

    select round(5/3,0)

    RESULT = 1

    What it is the explication for these difference ?

  2. #2
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,800
    Provided Answers: 11
    Code:
    select round(5/3,0), 5/3, 5.0/3.0
    Floating point vs integer math.

Posting Permissions

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