mysterious round behavior

monohusche's icon

Hi,

could someone explain to me why round behaves so weird for negative numbers ?

0.6 --> round = 1
1.4 --> round = 1
1.6 --> round = 2

-0.6 --> round = 0 ??
-1.4 --> round = 0 ??
-1.6 --> round = 0 ??

or am I missing something fundamental here ?

Mike S's icon

not sure why but perhaps do a little conversion from positive to negative to get round the problem

EDIT - just tried it here and it works fine with negative values, though i'm running 5.0.5

monohusche's icon

5.0.6 might be the culprit.

no worries, if known, I can take measures, it's just that those kind of bugs are so fundamental and therefore so hard to spot.

see attachment...

mzed's icon

monohusche wrote on Wed, 11 March 2009 09:085.0.6 might be the culprit.

no worries, if known, I can take measures, it's just that those kind of bugs are so fundamental and therefore so hard to spot.

see attachment...

I can't reproduce. Are you sure you have the right round? There are many abstractions distributed with that name. What happens if you double-click it?

mz

monohusche's icon

thx for the last comment which was on the the spot. that was indeed a different round from Karl-Heinz Essl

cheers, nick

Emmanuel Jourdan's icon

Thanks for confirming. Note that since 5.0.6 there's a nearest attribute and round can also round to any number not just the closest integer.

monohusche's icon

Actually, I have to admit that I was slightly confused to not see the second inlet mentioned in the documentation when looking at my wrong "round".

But not clever enough to make the connection.

all good.