trig errors

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Daft Pict

    trig errors

    Greetings,
    I am getting a data conversion error I cannot explain!

    This statement

    UPDATE dbImageList
    set cx = COS(RADIANS(CRV AL2))*COS(RADIA NS(CRVAL1)),
    cy = COS(RADIANS(CRV AL2))SIN(RADIAN S(CRVAL1)),
    cz = SIN(RADIANS(CRV AL2))

    results in this error message
    Msg 8115, Level 16, State 2, Line 1
    Arithmetic overflow error converting expression to data type float.
    The statement has been terminated.


    However, all fields crval1,crval2,c x,cy,cz are datatype float in the
    table.

    Any suggestions on how to perform this computation?
    Thanks
    -Brian
  • Erland Sommarskog

    #2
    Re: trig errors

    Daft Pict (brianjmclean@g mail.com) writes:
    Greetings,
    I am getting a data conversion error I cannot explain!
    >
    This statement
    >
    UPDATE dbImageList
    set cx = COS(RADIANS(CRV AL2))*COS(RADIA NS(CRVAL1)),
    cy = COS(RADIANS(CRV AL2))SIN(RADIAN S(CRVAL1)),
    cz = SIN(RADIANS(CRV AL2))
    >
    results in this error message
    Msg 8115, Level 16, State 2, Line 1
    Arithmetic overflow error converting expression to data type float.
    The statement has been terminated.
    >
    >
    However, all fields crval1,crval2,c x,cy,cz are datatype float in the
    table.
    >
    Any suggestions on how to perform this computation?
    I would certainly help if you could post a script that demonstrates
    the problem. That is, the script would include the CREATE TABLE statement
    for the table, and INSERT statements for data that causes this problem.

    Else we are left a bit in the dark.


    --
    Erland Sommarskog, SQL Server MVP, esquel@sommarsk og.se

    Books Online for SQL Server 2005 at

    Books Online for SQL Server 2000 at

    Comment

    • Ed Murphy

      #3
      Re: trig errors

      Daft Pict wrote:
      Greetings,
      I am getting a data conversion error I cannot explain!
      >
      This statement
      >
      UPDATE dbImageList
      set cx = COS(RADIANS(CRV AL2))*COS(RADIA NS(CRVAL1)),
      cy = COS(RADIANS(CRV AL2))SIN(RADIAN S(CRVAL1)),
      There's a missing * here; is that typo in your actual code, or did it
      just sneak in when you wrote your post?
      cz = SIN(RADIANS(CRV AL2))
      >
      results in this error message
      Msg 8115, Level 16, State 2, Line 1
      Arithmetic overflow error converting expression to data type float.
      The statement has been terminated.
      >
      >
      However, all fields crval1,crval2,c x,cy,cz are datatype float in the
      table.
      >
      Any suggestions on how to perform this computation?
      First try it with a WHERE clause that limits it to a single row of the
      table. If that succeeds, then do a few binary chops to determine which
      rows do or don't have problems.

      Comment

      Working...