3 ms·
I'm the Head of Engineering at Monzo. We don't use floating point at all in our core banking systems, which are all written in Go by our own engineering team :)
by obeattie 10y ago
I'm the Head of Engineering at Monzo. We don't use floating point at all in our core banking systems, which are all written in Go by our own engineering team :)
- runevault 10y agoSo is all the math just in cents and then you display it with the decimal if a user needs to see it?
- tclancy 10y agoThat is typically how you handle it (in my limited understanding). If you're going to make an error, let it be in the presentation layer and not the actual math.
- runevault 10y agoI now wonder if that is what c# does under the hood for currency type which is a rather safe way of dealing with a limited number of decimal places for money. Hm.
- oblio 10y agoWarning: I don't program applications for finance. However... I'm not sure that representing things in cents works. Mostly because of exchange rates. These can have quite a bit of decimals and go beyond cent-precision. My money's on BigIntegers: https://msdn.microsoft.com/en-us/library/system.numerics.biginteger(v=vs.110).aspx https://msdn.microsoft.com/en-us/library/system.numerics.big..., using some sort of subdivision of cents as the base unit (1/1000ths of cents?) I'm probably horribly wrong and I hope someone who actually knows what he's saying corrects me :)
- 53475 10y ago> My money's on BigIntegers: https://msdn.microsoft.com/en-us/library/system.numerics.big... https://msdn.microsoft.com/en-us/library/system.numerics.big..., using some sort of subdivision of cents as the base unit (1/1000ths of cents?) I was thinking something along these lines too. Would love to know what they used and the justifications behind their decision.
- obeattie 10y agoYep, that's exactly how it works.
- 53475 10y agoAny chance you could go into detail on this regarding data types? How do you handle exchange rates & such that can be to more precision than 100ths of a $ or other currency for instance?
- dharma1 10y agoI don't know how it works under the hood but when I use Monzo for Euro payments the conversion is shown in cents - they probably round it and pocket the difference. But the actual rate is very good, interbank rates