ROUND problem

  • Hello Comunity

    I have the following ROUND problem

    my value : 326,760000

    i need this calculation 326,760000*1.105/1.21

    the value of : 326,760000*1.105 = 361,070

    if i divide by 1.21 , the result is : 298.405

    I want to make ROUND for the final result is equal to : 298.41

    i test some round position:

    round(etiliquido*1.105,2) return 361,070, but if i make

    round(etiliquido*1.105,2) / 1.21 = 298,4049586776859

    or

    round(round(etiliquido*1.105,2)/1.21,2) = 298.40

    Someone could help me

    Many Thanks

    Luis Santos

  • Hmmm...

    Does this article put you on the right track?

    http://qa.sqlservercentral.com/articles/Advanced+Querying/afixfunctionintsql/2487/

    It seems like you are dealing with significant digits in scientific calculations.

    This function in particular just calculates 2 significant digits, but perhaps could be modified to suit your needs.

  • SELECT326.76 * 1.105 / 1.21,

    CEILING(326.76 * 1.105 / 1.21 * 100.0) / 100


    N 56°04'39.16"
    E 12°55'05.25"

  • There's something flawed in your math -

    326.760000*1.105 = 361.070 is not true. 361.0698 is the actual number.

    You can't round "mid operations" unless you plan on introducing large errors into your result. This will get you into large amounts of errors. You gotta go back and revisit all of those yucky "scientific precision" classes we all slept through in high school. Round mid-stream and you wouldn't hit the side of a barn with the precision issues you put in.

    I know what you'd "like" to see - but it's not the correct result.

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

  • Hello Matt

    I make the calc on a small calculator, and you have reason about your result, but i solve my problem using :

    round(round(cast(etiliquido*1.105 as decimal(10,2))/1.21,3),2)

    Many thanks

    Luis Santos

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply