Forum Replies Created

Viewing 15 posts - 196 through 210 (of 294 total)

  • RE: Bankers Rounding

    He also said:

    Cyberspace is - or can be - a good, friendly and egalitarian place to meet.

    - Douglas Adams

    and

    Don't believe anything you read...

  • RE: Bankers Rounding

    Infinity! From "why does this algorithm return inconsistant results?" to Infinity. And beyond!

    It is known that there is an infinite number of worlds, simply because there is an...

  • RE: Bankers Rounding

    As one of the 5 still reading this thread, (I feel a duty to, ) or is it now less, here are my results from...

  • RE: Bankers Rounding

    Ever wish you had not posted something? (Of course you have).

    People, enough already.

    Lynn, in his last post said

    "This started as a topic on a Bankers Rounding function"

    Actually, (and I'm sorry...

  • RE: Bankers Rounding

    The corrected Function

    -- =============================================

    -- Create scalar function (FN)

    -- =============================================

    IF EXISTS (SELECT *

               FROM   SYSOBJECTS

               WHERE  NAME = N'fn_BRound')

      DROP FUNCTION fn_BRound

    GO

    CREATE FUNCTION fn_BRound

                   (@p1 DECIMAL(30,20),

                    @p2 INT)

    RETURNS MONEY

    /*

     

    Round-to-even method (from http://en.wikipedia.org/wiki/Rounding)

     

    This...

  • RE: Bankers Rounding

    P.S That's two pints I owe you.  As well as Lynn, Antares686, Sergiy and the other who have contributed.

    Dave J

     

  • RE: Bankers Rounding

    Thanks Jeff, it does.  And credit to Sergiy and Lynn for spotting it.  For the record I did not want to start a "Holy War", we've got enough of those as...

  • RE: Bankers Rounding

    Oops, I thought your previous post was to me.  Having said that, can you tell me what is wrong with

    Floor(Abs(@Temp + 0.5 * Sign(@p1)))

    Preferably in non-math language

  • RE: Bankers Rounding

    Sergiy, as i said, ignoring the validity of 'bankers rounding', I just wanted to know why the original algorithm worked only sometimes. You wrote

      Here is the mistake:

      ... Floor(Abs(@Temp + 0.5...

  • RE: Bankers Rounding

    Just walked back into work and i was overwhelmed by the number of responses sat in my mailbox

    First of all, many thanks to...

  • RE: Bankers Rounding

    Wow! - quick response!

    Replaced all the float declares with decimal(38,20) but I still get bad results

                         

    ---------------------

    511.9500                     

    ---------------------

    512.9500                    

    ---------------------

    578.9500                    

    ---------------------

    654.9500

    --------------------...

  • RE: The T-SQL Quiz

    What a great thread.  Thanks to all for contributing to a tremendous read.

    Dave J

  • RE: INSERT_UPDATE Stored Proc

    As mentioned above, indentation is a wonderful thing. And your code has a misplaced END.  Try this

    SET ansi_nulls  ON

    SET quoted_identifier  ON

    GO

    /* *********************************************************************************************************************

    ******This stored procedure inserts a header according to its ID....

  • RE: Pivot Cross Tab for Text Results

    Another solution for this is at

    http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=8&messageid=242919#bm243627

    Jeff Moden was very generous.

    HTH

    Dave

  • RE: SQL 2000 TSQL question

    It may be worth pointing out that if your number starts with a Zero (0), as in the UK, it needs to be stored as a varchar. I agree...

Viewing 15 posts - 196 through 210 (of 294 total)