ID:132738
Nov 23 2009, 7:09 pm
|
|
round() currently goes to the nearest multiple of the multiple set, however I would like to see a round(num,mult,force) where force can be null, "up" or "down" depending on which way the programmer wishes to force a number.
| |
#1 Nov 23 2009, 7:15 pm
|
|
You can round down by subtracting half a unit, and up by adding half a unit. IE: round(x+0.5, 1) rounds up.
| |
Well that seems kind of inconvenient, It's a super basic C++ code called floor( float ).
A monkey could add that feature to BYOND. Just some simple math functions missing in BYOND which should already be there. Now Garthor, it isn't required for you to post something negative everywhere(trolling). There's nothing wrong with "convenience" features. :) | |
#3 Nov 23 2009, 7:26 pm
|
||
Leur wrote:
round() currently goes to the nearest multiple of the multiple set, however I would like to see a round(num,mult,force) where force can be null, "up" or "down" depending on which way the programmer wishes to force a number. round() without a second argument always rounds down to the mathematical floor, so if you want the floor or ceiling for a given multiple, it would be:
Lummox JR | ||
See, it's already in there and I didn't even know it. Now shew shew Garth go away! *Off Tekken goes to get his troll beating stick*.
:) | |
Tekken wrote:
See, it's already in there and I didn't even know it. Now shew shew Garth go away! *Off Tekken goes to get his troll beating stick*. Garthor was actually only offering a suggestion, and not rudely at all. The method he suggested will work just fine, though I'm sure he was aware of the fact that round() already does a floor operation when only one argument is used. Either way is reasonable. Lummox JR | |
oh, Thanks ;)
You ever check out my grid suggestion >.> | |
Oh fine fine, I'll be nice. It's hard to tell if someone is being a troll or not. Just dislike feature requests getting shot down over there being a work-around readily available. Convenience can always be really useful where it is available. Glad to know there are ways to round down and up already though. :)
| |
Yes, though at the moment I just remembered that the ceiling mucks up on whole numbers. I'm trying to remember if there's a simple solution besides just leaving already-rounded numbers alone.
| |
Garthor wrote:
Yes, though at the moment I just remembered that the ceiling mucks up on whole numbers. I'm trying to remember if there's a simple solution besides just leaving already-rounded numbers alone. -round(-x) will never muck up on whole numbers. Lummox JR | |