Hacker News new | past | comments | ask | show | jobs | submit login

Python will let you use float division on integers. Compiled type languages won't do that. This would be solved by using a double data type. But python doesn't have it.



You prooobably don't want to use doubles with financial data. Even in Java. Go for BigDecimal instead, for arbitrary precision instead of floating-point math.

And if you're doing that, python has the Decimal class for the same thing.


You'd almost certainly just use a library dedicated to mitigating this problem though, of which there are many.


Or you could just use a language with a static type system and avoid a whole class of bugs automatically.


Look, I like static type systems, but not all type systems are created equal, and some(with the easiest example being Go) are downright awful for helping encode business logic, forcing you to write immense amounts of code just to work around their awful type system decisions, code that often introduces bugs because of those issues.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: