Bug #9559 Functions: Numeric Operations using -ve value gives incorrect results.

Submitted: 1 Apr 2005 14:55 Modified: 31 May 2005 11:01
Reporter: Disha Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.3 Beta OS:Windows (Windows 2003)
Assigned to: Per-Erik Martin CPU Architecture:Any

[1 Apr 2005 14:55] Disha
Description:
If a function returns the result of a numeric operation, in which a negative value is used, the function always returns 0 regardless of the values passed.

This works fine when used in a stored procedure.

How to repeat:
delimiter //
Drop function if exists fn1//
Create function fn1() returns INT  
Begin
             set @y = -6/2;
	return @y;
End//
Select fn1()//

Actual Result:
	+---------+
	| fn1(15)  |
	+---------+
	|       0    |
	+---------+

Expected Result:
	+---------+
	| fn1(15)  |
	+---------+
	|       -3   |
	+---------+
	

Suggested fix:
[1 Apr 2005 15:02] Disha
Updated version
[27 May 2005 18:35] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/25316

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.049 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.