News for hackers. Stuff that matters.
Re:Mimalloc Cigarette: Losing one week of my life catching a... by smh on Thursday August 22, 2024 @07:34AM (#41319075)
You are using 32 bit floats to represent money?

Does your project correctly calculate $300,000.00 + $0.01, (or even just correctly represent the value $300,000.01) and if so, how?

Re:Mimalloc Cigarette: Losing one week of my life catching a... by nurettin on Thursday August 22, 2024 @11:38AM (#41321471)
Obviously you can't accumulate cent by cent. You can't even safely accumulate by quarter. Epsilon is too large to do that. I calculate cumulative pnl using std::fma, then multiply AUM with that and round to cents. It's good enough for backtesting, and it shaves a bunch of seconds off the clock.
Re:Mimalloc Cigarette: Losing one week of my life catching a... by smh on Thursday August 22, 2024 @12:47PM (#41322102)
I see - I guess it's a financial modelling program or similar where the quantities don't represent precise values of money. I was imagining some kind of accounting-like app that would need to be reconciled with real-world balances.
Re:Mimalloc Cigarette: Losing one week of my life catching a... by nurettin on Thursday August 22, 2024 @03:37PM (#41323710)
Yes, we work with futures and the largest transaction is around 1000 qty. It is so rare that most banks have a fat finger alert for such quantities.