Issue Details (XML | Word | Printable)

Key: CORE-2281
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Claudio Valderrama C.
Reporter: Paul Vinkenoog
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.
Firebird Core

*round UDFs broken for negative numbers

Created: 18/Jan/09 10:21 PM   Updated: 19/Jan/16 04:57 AM
Component/s: UDF
Affects Version/s: 1.5.5, 2.0.4, 2.1.1
Fix Version/s: 2.5 Beta 1, 2.1.3, 1.5.6, 2.0.6

QA Status: No test

 Description  « Hide
Anything on <-0.6, 0] rounds to 0
Anything on <-1, -0.6] rounds to +1
Anything on <-1.6, -1] rounds to -1
Anything on <-2.6, -1.6] rounds to -2
Anything on <-3.6, -2.6] rounds to -3
and so on

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Claudio Valderrama C. added a comment - 21/Jan/09 06:40 AM
Since this problem was reported privately by Paul Vinkenoog privately to me months ago but I didn't have time to fix it until recently and he put the tracker item when I showed it a change fbudf, I'm going to commit the same code in all affected branches. Not necessarily what Paul wanted, since round and trunc in fbudf were mean to be asymmetric like in the math definition (unlike Delphi functions).
round always rounds to the next bigger integer when it's in the upper half of the range (including x.5).
trunc always truncates to the biggest integer that's equal or smaller than the argument.