Archive pour décembre 2023
Overflow-safe integer mul&div
Posté par Olivier dans Trucs & Astuces le 22 décembre 2023
When you do a multiply & divide operation, to ensure you don’t loose precision, you would start by the multiplication before the division. But in that case, it could be that the result of the multiplication overflows. The natural solution would go to use an intermediate storage of larger size. This uses concepts (C++20). For […]