Equally the allocation trick is good, but you’ll find that the people who really care about this stuff really care about the exact algorithm you’re using and who it favours.
Anyway, the allocation may be tweaked to favour where the additional/missing pennies will be allocated. You can find more at: https://github.com/eriksencosta/money/blob/trunk/docs/usage/...
Sometimes you can do all calculations in a single currency and convert at reporting time. I've worked on teams where that was fine.
Sometimes... you really cannot do that.
The OP just described a language feature where you want to multiply euros with usd one place and yen and dinar in another.
You don’t need to do that which is why a decimal or 64 bit int is a fine language approach.