Hi,
The round component has type Int32 as output, so it is limited to round numbers smaller than 2^31. In this document I’ve seen that there’s a type gh_int64, would it be possible to change the output of the Round-component to this type?
I encountered this problem when multiplying a number around ~1e4 by the number 1e6 for the purpose to round it and then divide it back by 1e6 to get 6 decimal places. This is faster than using expression editor and the Round(x,n) function and I have a lot of numbers to round.
Thanks for the reply. At first stage I used the expression editor component which is the slowest solution. My workaround multiply-round-divde took in total about 50% of that time and with a quick multiply component about 35% of that time. I didn’t check your solution and it is actually the fastest, taking only 25% of the time of the expression editor. So I guess that’s what I’ll be using in the future, thanks for that.
This went off topic a bit because it was about the output data type of the Round component in the beginning but I think we can agree that this component is not really practical to use anyway if you want to round to a certain decimal place. And right now I have no example where you should be able to round floating point numbers as high as ~10e10 to their integers.
The performance bottleneck is likely more related to data-piping of 100k items than rounding here. Also the int32 issue is more likely because of implicit type conversion in the component and not because of using int32 for rounding. This is also why Joseph solution is performing best. The Eval component is something special for large data, because the expression parsing is not implemented efficiently. So this is something you should always prevent if performance matters.