Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
mark1504
Posting Yak Master
103 Posts |
Posted - 2006-01-19 : 08:21:11
|
| I have a program to calculate holiday entitlement based on pro rata per annum.How do I convert (rounding down) the result into a number that is either integer or ending in .5?ThanksMark |
|
|
Arnold Fribble
Yak-finder General
1961 Posts |
Posted - 2006-01-19 : 08:27:41
|
| FLOOR(yourNumber*2.0)/2.0 |
 |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2006-01-19 : 10:57:49
|
What about negative numbers? CODO ERGO SUM |
 |
|
|
Arnold Fribble
Yak-finder General
1961 Posts |
Posted - 2006-01-19 : 11:17:41
|
quote: Originally posted by Michael Valentine Jones What about negative numbers? 
Depends whether "round down" means round toward zero or round toward negative infinity. I assumed the latter, on the basis that it's easier to write*. I'd hope that negative holiday entitlements are not an issue. * Edit: it's not that much harder to do toward zero, just use the truncate flag on ROUND:ROUND(yourNumber*2.0, 0, 1)/2.0 |
 |
|
|
mark1504
Posting Yak Master
103 Posts |
Posted - 2006-01-19 : 13:46:08
|
| Thanks Arnold, that's what I'll do.And as you rightly pointed out in your second post, negatives holidays are permitted but the rounding wouldn't be an issue.ThanksMarkCASE CLOSED |
 |
|
|
|
|
|