Preventing Arithmetic overflow error when using POWER function

  • Hello,

    Any help appreciated. This code should perform a internal rate of return (IRR) calculation. It generates correct data based on what was provided to me using Excel's IRR function.

    It looks like as GETDATE() gets close to my hard coded date the error is generated. Any suggestion to prevent the error would be appreciated.

    SELECT
    POWER
    (
    CONVERT(FLOAT,CONVERT(DECIMAL(30,6),322.000000)/NULLIF(4.079000,0)),
    CONVERT(FLOAT,365)/COALESCE((NULLIF(DATEDIFF(d,GETDATE(),'2023-06-30'),0)),365)
    )
    -1

     

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

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

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

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