Yes it needs to be rounded because it’s already been multiplied by 100 to obtain a value in cents to pass to Stripe API which expects an integer.
Floor or ceiling would create incorrect rounding as 0.9 would become 0 or 0.1 become 1 in some cases.
The documentation states that 0.5 should round up, which I’m fine with.
My problem has stated in the first message, is that sometimes it doesn’t apparently…
The actual, correct, mathematical answer to your calculation is indeed 393.5
But..
Because some numbers cannot be accurately represented in binary (without repeating infinitely), the computed answer is actually 393.49999999999994 (bubble just rounds it to 1 decimal place by default, giving 393.5).
so when you round it to 0 decimal places, you’re rounding the actual calculated value (393.49999999999994) which is why you get 393 and not 394.