5 messages in com.mysql.lists.bugsRE: Trig functions return NULL on Sol...| From | Sent On | Attachments |
|---|---|---|
| Pastor.Phil | 17 May 2001 12:54 | |
| Michael Widenius | 18 May 2001 05:59 | |
| Pastor.Phil | 18 May 2001 06:30 | |
| Pastor.Phil | 18 May 2001 07:05 | |
| Michael Widenius | 20 May 2001 04:07 |
| Subject: | RE: Trig functions return NULL on Solaris, not NT![]() |
|---|---|
| From: | Pastor.Phil (pas...@nmedia.com) |
| Date: | 05/18/2001 06:30:16 AM |
| List: | com.mysql.lists.bugs |
ooops, a little premature with my praise for you.
GREATEST(x,y,z,...) returns the largest value from the list. So, GREATEST(1.0000001, 1.0) would return 1.0000001 which still does not solve the problem
======================================== Phil Pastor Sr. Consultant NewMedia, Inc. (216) 518-7900 x 7924
-----Original Message----- From: Michael Widenius [mailto:mon...@mysql.com] Sent: Friday, May 18, 2001 9:00 AM To: Pastor.Phil Cc: 'bu...@lists.mysql.com' Subject: Trig functions return NULL on Solaris, not NT
Hi!
"Pastor" == Pastor Phil <pas...@nmedia.com> writes:
Pastor> From: pas...@nmedia.com Pastor> To: mys...@lists.mysql.com Pastor> Subject: Trig functions return NULL on Solaris, not NT
Description:
Pastor> I have a select statement that uses the trigonometric functions. In Pastor> the example below I have hardcoded some numeric values Pastor> that cause this select to return NULL on a Solaris machine. PLEASE Pastor> NOTE: that on an NT machine this select returns 0.000 Pastor> which is the correct answer.
How-To-Repeat:
Pastor> SELECT 3963.0 * ACOS( (SIN(0.829855) * SIN(0.829855)) +
Pastor> (COS(0.829855) * COS(0.829855) * COS(-2.134772 - (-2.134772))) ) AS test
Things like this is to be expected when you are using floating point values (that are not exact).
The problem is that the expression inside ACOS() is approximally 1.
In NT this is probably 0.999999999999 while it on Solaris is 1.000000000001.
Both values are acceptable when dealing with floating point values.
The problem is that ACOS() is not defined for values larger than 1.0 Because of this you will get NULL (error) on Solaris.
Fix:
Use LEAST(GREATEST(expression,1.0),-1.0) inside ACOS() to ensure that the value is in the acceptable range.
Regards, Monty




