none
An invalid floating point operation occurred

    Question

  • why do i get an error while running this command

    select (POWER((0.1935 /-0.0972 ),0.5) - 1 )

    and what is the solution for this

    Error:

    An invalid floating point operation occurred.

    Tuesday, October 5, 2010 3:26 PM

Answers

  • you are trying to find square root of a negative number, which is an invalid... some complex numbers come into pic.. u can write like below.

     

    declare @I float
    set @I = -0.0972
    select (POWER((0.1935 /abs(@I) ),0.5) - 1 ) * (case when @I < 0 then -1 else 1 end)
    
    

     

     

    • Marked as answer by rohit_patel81 Tuesday, October 5, 2010 3:42 PM
    Tuesday, October 5, 2010 3:35 PM

All replies

  • you are trying to find square root of a negative number, which is an invalid... some complex numbers come into pic.. u can write like below.

     

    declare @I float
    set @I = -0.0972
    select (POWER((0.1935 /abs(@I) ),0.5) - 1 ) * (case when @I < 0 then -1 else 1 end)
    
    

     

     

    • Marked as answer by rohit_patel81 Tuesday, October 5, 2010 3:42 PM
    Tuesday, October 5, 2010 3:35 PM
  • thanks
    Tuesday, October 5, 2010 3:41 PM