Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Truncation: Difference between revisions

From Coderwiki
new: info, truncation
 
(No difference)

Latest revision as of 17:18, 14 August 2025

Truncation is a form of rounding where the result is always floored. This essentially means that the non-integer (decimal) part of a float is 'chopped off' (truncated).

Below some floating point numbers are shown, as well as the integers they round to when truncated:

1.2 -> 1
7.9 -> 7
8.0 -> 8
9.9 -> 9
-3.4 -> -3
-7.8 -> -7
Contents