That’s correct. I’ve also tried using parseInt((infected * 0.2).toFixed(0)), as well as rewriting in Python and using the round() function, but always with the same result.
As I mentioned, I have tried this using Number.toFixed() as well as Python’s round() functions. All of these methods round up to the nearest whole number. By the way, adding 0.5 to a floating point number and truncating the result is pretty much standard practice for rounding up, especially in languages that don’t provide a rounding function.
Using ceil is the standard practice for rounding up. Adding 0.5 and rounding down should only be used if the language refuses to support a proper ceil function. Hacks are asking for errors and in this place you’re asking for the potential for floating point rounding issues as you need to rely upon correctly adding 0.5
Generally, you should only do a hack if you cannot do the actual thing you want to do directly