5 messages in com.mysql.lists.bugsTrig functions return NULL on Solaris...| 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: | Trig functions return NULL on Solaris, not NT![]() |
|---|---|
| From: | Michael Widenius (mon...@mysql.com) |
| Date: | 05/18/2001 05:59:54 AM |
| List: | com.mysql.lists.bugs |
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




