Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*truncate UDFs broken for numbers below -1 [CORE2282] #2708

Closed
firebird-automations opened this issue Jan 19, 2009 · 7 comments
Closed

*truncate UDFs broken for numbers below -1 [CORE2282] #2708

firebird-automations opened this issue Jan 19, 2009 · 7 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @paulvink

Assigned to: Claudio Valderrama C. (robocop)

For numbers below -1, *truncate returns the nearest lower number (e.g. -2.1 -> -3; -45.88 -> -46). This is 'floor' rather than 'truncate'.

On <-1, 0], truncate returns 0.
Only -1 truncates to -1.
(The last two results are correct; just given here for completeness.)

Commits: b2b178f 57ed00d 89fdae4 bc2e065

@firebird-automations
Copy link
Collaborator Author

Commented by: Claudio Valderrama C. (robocop)

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.

@firebird-automations
Copy link
Collaborator Author

Modified by: Claudio Valderrama C. (robocop)

assignee: Claudio Valderrama C. [ robocop ]

@firebird-automations
Copy link
Collaborator Author

Modified by: Claudio Valderrama C. (robocop)

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 2.5 Beta 1 [ 10251 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: Claudio Valderrama C. (robocop)

Fix Version: 2.1.2 [ 10270 ]

Fix Version: 1.5.6 [ 10225 ]

Fix Version: 2.0.6 [ 10303 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

Fix Version: 2.1.3 [ 10302 ]

Fix Version: 2.1.2 [ 10270 ] =>

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

QA Status: No test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment