Loading...

Top
PFQ Banner

This is PokéFarm Q, a free online Pokémon collectables game.

Already a user? New to PFQ?

Single post in A Somewhat Extensive Guide to BBCodes

Forum Index > PokéFarm > Guides > A Somewhat Extensive Guide to BBCodes >

Kahuna's AvatarKahuna
Kahuna's Avatar

QUOTE originally posted by omg

im sorry if this has been asked before, but i was wondering if theres any way to round the results of the math bbcode, just to the nearest whole number? or is there a way to even just hide the numbers after a decimal altogether, and just show the whole number? its okay if not, its easy to just make do with what we've got now ofc ^^ was just curious if anyone had pointers in how i could play with that!!
I think there might be a better way to do it than this but I'm not sure what it is. The output of [math] is always rounded to the nearest hundredth, so we can exploit that with multiplication and division to round it to any higher decimal placement that we want. If I take the number 3.55 and want to round it, first I do:
[math]3.55/100[/math]
which results in: 0.04 Then to restore it back to its original state, we reverse the division by multiplying by 100. We have to do this in a separate math block, because it does not round until it calculates the full result of the math block. Our end expression is:
[math][math]3.55/100[/math]*100[/math]
which results in: 4 So to round any expression to the nearest whole number, we can use:
[math][math](any math expression)/100[/math]*100[/math]
If I forget to respond to a post or trade please PM me! I may have forgotten to subscribe. Avatar from Pokémon Showdown April Fools Day sprites, recolored by me.
© PokéFarm 2009-2024 (Full details)Contact | Rules | Privacy | Reviews 4.6★Get shortlink for this page