The round operation bug

if i try to round 2.5 it says 2 but it accuatly should say 3 or not ? :grin:
from .0-.4 it should round down and from .5-.9 it should round up or not ?
it only round up at .51 but in germany we learn to round up from .5 and i think that all over the world the same :joy:

1 Like

I think what happens is it’s in DP instead, so DP - 4 = PX, so if you do 3 PX Border Radius + 4 DP, that’d equal 7 DP but, you’re really getting 3 PX of Border Radius.


i think its meant for a other topic ?


xD I thought you were talking about the Card Border Radius, I didnt read fully, sorry LOL.

@Diego can you fix it ?

What happens in AppInventor?
Does it get rounded down or up?

wait a sec i will try

@Diego there is the same bug
it says 2 but this is just mathematically wrong it round up from 2.51 but it should round up at 2.5(in ai2 makeroid etc. it rounds down)

I will report it to MIT :+1:

1 Like

okay nice thank :grin:

1 Like

i just found out its a bit more weird at 1.5 it rounds up and at 0.5 it rounds down just like at 2.5

I don’t think this is an issue, see here:

If it is exactly equal to .5, numbers with an even whole part will be rounded down, and numbers with an odd whole part will be rounded up.

But in Maths you always round up if it’s .5, no?
At least it is how I was teached :sweat_smile:

If the fractional part is < .5 it will be rounded down. It it is > .5 it will be rounded up

its just so weird as i posted at 1.5 it rounds up and at 0.5 and 2.5 it rounds down ???

Yeah, I also agree with this. I learnt this when I was in 2nd standard. :sweat_smile:

ahhh i just understood what @Conor mean so 1.5, 3.5 ,5.5 and so on will round up and
0.5,2.5,4.5 and so on round down???

Even numbers are rounded down. So 2.5 will be rounded down to 2 and 4.5 will be rounded down to 4.

Odd numbers are rounded up. So 1.5 will be rounded up to 2 and 3.5 will be rounded up to 4.

yea but why do they do this like this its just mathematically wrong nobody does that ??:joy::joy:

1 Like