|
OpenTTD Source 20251104-master-g3befbdd52f
|
Math functions. More...
Go to the source code of this file.
Functions | |
| int | DivideApprox (int a, int b) |
| Deterministic approximate division. | |
| uint32_t | IntSqrt (uint32_t num) |
| Compute the integer square root. | |
Math functions.
Definition in file math_func.cpp.
| int DivideApprox | ( | int | a, |
| int | b | ||
| ) |
Deterministic approximate division.
Cancels out division errors stemming from the integer nature of the division over multiple runs.
| a | Dividend. |
| b | Divisor. |
Definition at line 22 of file math_func.cpp.
References abs().
Referenced by StationViewWindow::BuildCargoList(), and StationViewWindow::EstimateDestinations().
| uint32_t IntSqrt | ( | uint32_t | num | ) |
Compute the integer square root.
| num | Radicand. |
Definition at line 42 of file math_func.cpp.
Referenced by CanalMaintenanceCost(), RailMaintenanceCost(), RoadMaintenanceCost(), SignalMaintenanceCost(), and StationMaintenanceCost().