floatround problem [FIXED]
#1

Is there anyway i can just round off to a higer value always. I tried other methods in roundoff param. But none worked. I want that if i floatround (1.1) it returns it as (2.0) !
Reply
#2

Try
pawn Код:
stock Roundup(Float: val) {
      return floatround(val, floatround_round);
}
Untested.
Reply
#3

Quote:
Originally Posted by Abagail
Посмотреть сообщение
Try
pawn Код:
stock Roundup(Float: val) {
      return floatround(val, floatround_round);
}
Untested.
That wont even work! Its just a new definition of the function without the param (method)!
And i solved it :P

pawn Код:
new result = 0;
new items = 50;
new Float:value = items / 15.0;
            if((floatround((items / 15))) >= value)
            {
                result = floatround((items / 15));
            }
            else
            {
                result = floatround((items / 15)) +  1;
            }
Reply
#4

https://sampwiki.blast.hk/wiki/Floatround
https://sampwiki.blast.hk/wiki/Floatround_method

pawn Код:
floatround(items/15, floatround_ceil);
Nice..
Reply
#5

Quote:
Originally Posted by Threshold
Посмотреть сообщение
https://sampwiki.blast.hk/wiki/Floatround
https://sampwiki.blast.hk/wiki/Floatround_method

pawn Код:
floatround(items/15, floatround_ceil);
Nice..
I had that before but it didn't worked, idk why!

Here i made a debug:
pawn Код:
main()
{
    printf("%d", floatround(38/15, floatround_ceil));
}
Result:
pawn Код:
2
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)