T-SQL Trigonometric Functions in SQL Server

  • Comments posted to this topic are about the item T-SQL Trigonometric Functions in SQL Server

  • Thanks for posting your issue and hopefully someone will answer soon.

    This is an automated bump to increase visibility of your question.

  • What is the performance like?

    I wrote an image transformation program once to run on slow equipment. Before the calculations, I created an array indexed on the degree range I was working with, populating the values with the result of the trig function. In sql server, that would mean creating a table object with a column for the degree value, and a column for each trig function of that degree. Then the calculations happen once, and after that it is a simple table lookup, which sql server excels in.

    This would help keep the CPU/FPU load low in the case where you are doing many calculations.

  • Really nice article that explains the "FLOAT problem", Imran2629.  Thanks for taking the time to put it together,

    It's amazing to me that MS apparently hasn't figured out how to use the math co-processor on CPUs that have been present on the cpu chips since 1989.

    Even the DECIMAL and NUMERIC datatypes have a problem...

    https://learn.microsoft.com/en-us/sql/t-sql/data-types/precision-scale-and-length-transact-sql  .

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

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

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