I get the same thing on 2000 SP3 (760). I'll see what I can do to report
it...
"Scott Archibald" <com> wrote in message
news:018301c3680c$d4037b00$gbl...
I am running a query that takes the cross product of a table against itself and uses some trigonometry functions to determine the distance between all the values. The cross product works but when I introduce the trig function only part of the result set comes back. No error is reported only a very non-descriptive message: A domain error occurred. Has anyone ever seen this before? I have not been able to find any information on it web. Here is a query that tes the error I am getting using the Northwind database: Select o1.OrderID, o2.OrderID, foo = ACOS( COS(o1.OrderID) ...
I am running a query that takes the cross product of a
table against itself and uses some trigonometry functions
to determine the distance between all the values. The
cross product works but when I introduce the trig
function only part of the result set comes back. No
error is reported only a very non-descriptive message:
A domain error occurred.
Has anyone ever seen this before? I have not been able
to find any information on it web.
Here is a query that tes the error I am getting
using the Northwind database:
Select
o1.OrderID,
o2.OrderID,
foo =
ACOS(
COS(o1.OrderID) * COS(o2.OrderID) +
SIN(o1.OrderID) * SIN(o2.OrderID)
)
From
Orders o1 Cross Join Orders o2
Thanks for taking a look. -Scott
I get the same thing on 2000 SP3 (760). I'll see what I can do to report
it...
"Scott Archibald" <com> wrote in message
news:018301c3680c$d4037b00$gbl...
Methinks there are combinations of (o1.OrderID, o2.OrderID) where the argument of ACOS is beyond +/- 1.0. How about runnin gthe query without ACOS and just compute the remainder. List those where the absolute value is > 1.0.
--
Tom
--------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com.sql
..
"Scott Archibald" <com> wrote in message news:00f801c36810$4241a670$gbl...
It seems the error is related to the ACOS function. I
can't te the error without ACOS but the error
always occurs regardless of how simple the function is if
the ACOS function exists.
-Scott
can do to report [/ref]
functions
>
>
>.
>[/ref]
Precisely. Trig functions return float, with the infamous
rounding errors. These rounding errors result in values
outside the +- 1 range. Try:
Select
o1.OrderID,
o2.OrderID,
foo = COS(o1.OrderID) * COS(o2.OrderID) + SIN
(o1.OrderID) * SIN(o2.OrderID)
From
Orders o1 Cross Join Orders o2
where COS(o1.OrderID) * COS(o2.OrderID) + SIN(o1.OrderID)
* SIN(o2.OrderID) > 1
and you'll see your offending rows. You can fix it by
CASTing the value to, e.g., numeric(9,8), before you apply
the ACOS function.
Select
o1.OrderID,
o2.OrderID,
foo =
ACOS(
CAST(COS(o1.OrderID) * COS(o2.OrderID) +
SIN(o1.OrderID) * SIN(o2.OrderID) AS numeric(9,8))
)
From
Orders o1 Cross Join Orders o2
HTH
Vern
o2.OrderID) where the argument of ACOS is beyond +/- 1.0.
How about runnin gthe query without ACOS and just compute
the remainder. List those where the absolute value is >
1.0.
news:00f801c36810$4241a670$gbl...
if [/ref]
I [/ref][/ref]
a [/ref]
> functions [/ref][/ref]
The [/ref][/ref]
message: [/ref][/ref]
able [/ref][/ref]
getting
> >
> >
> >.
> >[/ref][/ref]
Bookmarks