Número truncado

O truncamento reduz a precisão para zero e não aplica regras de arredondamento ou empate.

🔢
Calculadora de arredondamento
Insira um número e escolha suas preferências de arredondamento
|
🧪 Exemplos rápidos

What Is Truncation?

Truncation removes digits from a number beyond a specified position without rounding the remaining digits. For decimal numbers, truncation toward zero removes the unwanted fractional digits while keeping the number closer to zero.

2.987 → 2.98
2.987 → 2.9
−2.987 → −2.98
2.987 → 2

How Does Truncation Work?

Applying truncation requires following a simple, strict rule:

1

Start with the original number

For example, take the number 45.6789.

2

Choose the position to keep

Decide the number of decimal places to retain (e.g., 2 decimal places).

3

Keep digits through that position

Identify the digits up to the cut-off point (45.67).

4

Remove all digits after

Discard everything else (89). Do not change the retained digits, yielding 45.67. No rounding occurs.

How to Truncate a Number to a Whole Number

Truncation to a whole number simply removes the entire fractional portion of the value, leaving only the integer.

  • 2.99 → 2
  • 2.01 → 2
  • −2.99 → −2
  • −2.01 → −2

Notice that for negative numbers, truncation removes the fraction, meaning the result moves closer to zero. This is critically different from the mathematical floor function.

Floor of −2.99 = −3
Truncation of −2.99 = −2

How to Truncate to Decimal Places

To truncate a number to a specific number of decimal places, you simply keep that many digits after the decimal point and delete the rest.

Example for 12.9876:

  • 1 decimal place: 12.9876 → 12.9
  • 2 decimal places: 12.9876 → 12.98
  • 3 decimal places: 12.9876 → 12.987
  • 4 decimal places: 12.9876 → 12.9876

Example for −12.9876 (The sign does not change):

  • 1 decimal place: −12.9876 → −12.9
  • 2 decimal places: −12.9876 → −12.98
  • 3 decimal places: −12.9876 → −12.987

How Does Truncation Handle Negative Numbers?

Truncation toward zero moves negative numbers strictly toward zero.

Because the negative sign remains unchanged and the fractional part is simply deleted, the resulting value is technically greater than the original (e.g. −3 is greater than −3.9).

  • −3.9 → −3
  • −3.5 → −3
  • −3.1 → −3
  • −3.99 to 1 decimal place → −3.9
  • −3.99 to 2 decimal places → −3.99
Method Input: −3.9 Result
Truncate−3.9−3
Floor−3.9−4
Ceiling−3.9−3

This is a critical distinction: truncation behaves identically to the ceiling function for negative values, whereas it behaves like the floor function for positive values.

How Does Truncation Handle Positive Numbers?

For positive numbers, the fractional digits are simply removed, meaning the number moves toward zero (downward on the number line).

  • 3.9 → 3
  • 3.99 → 3
  • 15.678 → 15.67
  • 123.4567 → 123.45

What Happens When the Number Is Already an Integer?

If the number is already an integer (a whole number), truncation leaves it completely unchanged because there are no fractional digits to remove.

  • 5 → 5
  • 0 → 0
  • −5 → −5
  • 100 → 100

What Is the Truncation of Zero?

Truncating zero or any variation of zero simply results in zero.

  • 0 → 0
  • 0.0 → 0
  • −0.5 → 0 (when truncating toward zero to a whole number)

Truncating Fractions

Truncation can also apply after evaluating a fraction into its decimal form.

Example 1: 7 / 3 = 2.333...
Truncate to 2 decimal places: 2.33

Example 2: 11 / 4 = 2.75
Truncate to 1 decimal place: 2.7

Example 3: −7 / 3 = −2.333...
Truncate toward zero to 2 decimal places: −2.33

Truncation Examples

Input Target Truncated Result Explanation
2.99Whole number2Remove the fractional part
−2.99Whole number−2Move toward zero
45.67892 decimal places45.67Remove digits after the second decimal
12.98761 decimal place12.9Remove digits after the first decimal
−12.98762 decimal places−12.98Remove digits after the second decimal
7.9992 decimal places7.99No rounding occurs

Truncation Formula

The mathematical concept behind truncating toward zero to a specific number of decimal places (n) involves scaling the number, dropping the fraction, and scaling back.

trunc(x × 10ⁿ) / 10ⁿ

This works by:

  1. Multiplying by 10ⁿ to move the target decimal place to the integer position.
  2. Truncating toward zero to drop the remaining fractional portion.
  3. Dividing by 10ⁿ to restore the original decimal placement.

Positive Example

Truncate 12.987 to 2 decimal places:

  • 12.987 × 100 = 1298.7
  • trunc(1298.7) = 1298
  • 1298 / 100 = 12.98

Negative Example

Truncate −12.987 to 2 decimal places:

  • −12.987 × 100 = −1298.7
  • trunc(−1298.7) = −1298
  • −1298 / 100 = −12.98

Truncation Function

Mathematically, truncation toward zero for a real number x can be defined piecewise using the floor and ceiling functions:

trunc(x) = floor(x) when x ≥ 0
trunc(x) = ceiling(x) when x < 0

Alternatively, using the sign function (sgn or sign) and absolute value (|x|):

trunc(x) = sign(x) × floor(|x|)

Both formulas mathematically enforce the "move toward zero" rule for both positive and negative values.

Truncation vs Rounding

Truncation and rounding are fundamentally different operations. Truncation simply ignores the discarded digits entirely. Rounding uses the discarded digits to decide whether the retained digits should be increased.

Example 1: 2.987

  • Truncate to 2 decimal places: 2.98
  • Round to 2 decimal places: 2.99

Example 2: 2.983

  • Truncate to 2 decimal places: 2.98
  • Round to 2 decimal places: 2.98

Example 3: −2.987

  • Truncate toward zero: −2.98
  • Round to nearest hundredth: −2.99

Truncation does not imply that it is a type of nearest-value rounding; it is a separate cutoff mechanism.

Truncation vs Floor Function

Truncation moves values toward zero. The floor function moves values toward negative infinity.

For positive numbers, they act identically. For negative numbers, they move in opposite directions. This makes the negative-number difference extremely clear.

Input Truncate (Toward Zero) Floor (Toward −∞)
2.722
2.122
−2.1−2−3
−2.7−2−3
−5.9−5−6

Truncation vs Ceiling Function

Truncation moves toward zero. The ceiling function moves toward positive infinity.

For negative values, truncation and ceiling often produce the same integer result because moving toward positive infinity from a negative decimal leads to zero. For positive numbers, they differ.

Input Truncate Ceiling
2.723
−2.7−2−2
−2.1−2−2

Is Truncation the Same as Rounding Down?

No. Truncation toward zero and mathematical floor rounding (often informally called "rounding down") are different operations for negative numbers.

Consider the value −2.7:

  • Truncation → −2
  • Floor (Rounding Down) → −3

Because the term "round down" can be ambiguous, always clarify whether you mean moving strictly toward negative infinity (floor) or stripping digits toward zero (truncate).

Truncation vs Round Half Up

Round Half Up considers the next digit to decide whether to change the retained value, pushing exact ties away from zero.

For 2.65 to 1 decimal place:

  • Truncation → 2.6
  • Round Half Up → 2.7

For −2.65 to 1 decimal place:

  • Truncation → −2.6
  • Round Half Up → −2.7

Truncation vs Banker's Rounding

Banker's Rounding is a nearest-value rule with special handling for exact halfway cases. Truncation simply removes digits without any tie-breaking rules.

For 2.65 to 1 decimal place (exact halfway, retaining an even digit):

  • Truncation → 2.6
  • Banker's rounding → 2.6

For 2.75 to 1 decimal place (exact halfway, retaining an odd digit):

  • Truncation → 2.7
  • Banker's rounding → 2.8

Truncation on a Number Line

Visually, truncation always pulls a non-integer value inward toward zero on the number line.

  • For positive values (2.8 → 2), it pulls the value to the left (toward zero).
  • For negative values (−2.8 → −2), it pulls the value to the right (toward zero).

Compare this to floor, which always moves to the left (−2.8 → −3) regardless of the sign.

When Should You Use Truncation?

Truncation is highly specific and should be used depending on the requirements of the calculation. You should use truncation when:

  • Displaying a fixed number of decimal places without rounding.
  • Removing extra precision entirely.
  • Processing measurements where the specified cutoff is intentional.
  • Performing certain programming and data-processing tasks.
  • Implementing controlled numerical display where increasing the displayed value would be undesirable.

Truncation is not always better or worse; it simply serves distinct analytical needs compared to standard rounding.

Real-World Uses of Truncation

Concrete examples where truncation is preferred include:

  • Financial display: Some specific financial displays explicitly require truncating partial cents downward to prevent showing inflated balances, though actual arithmetic often requires specific rounding rules.
  • Measurement data and sensor values: Dropping excessive precision from sensor noise before storage to save space.
  • Digital displays: Progress bars showing 99.9% complete will often truncate to 99% to prevent prematurely displaying 100%.
  • Data reporting: Statistics and data preprocessing often employ truncation to bucket demographic data securely.
  • Scientific calculations: Environments where a fixed cutoff is required by a strict protocol.

Truncation in Programming

Programming languages provide different functions specifically intended for truncating values.

Truncation in Python

Use the math.trunc() function from the math module to truncate a number toward zero. Do not confuse it with math.floor().

import math
math.trunc(2.99) // Returns 2
math.trunc(-2.99) // Returns -2

Truncation in JavaScript

Use the Math.trunc() function to easily remove the fractional digits of a number toward zero.

Math.trunc(2.99) // Returns 2
Math.trunc(-2.99) // Returns -2

Truncation in Java

In Java, explicitly casting a floating-point number to an integer performs mathematical truncation.

(int) 2.99 // Returns 2
(int) -2.99 // Returns -2

Truncation in C#

Use Math.Truncate() which removes the fractional part toward zero.

Math.Truncate(2.99) // Returns 2
Math.Truncate(-2.99) // Returns -2

Truncation in Excel

Use the TRUNC(number, num_digits) function. By default, it truncates to a whole number, but you can easily specify decimal places.

TRUNC(2.987, 2) // Returns 2.98
TRUNC(-2.987, 2) // Returns -2.98
TRUNC(2.987) // Returns 2

Truncation in SQL

Different database systems use different functions. PostgreSQL and Oracle offer a native TRUNC() function, whereas SQL Server often relies on ROUND(value, decimals, 1) to force truncation instead of rounding.

Common Truncation Mistakes

  • Thinking truncation means nearest rounding: Correction — Truncation ignores discarded digits entirely and never rounds up.
  • Thinking truncation always moves downward: Correction — It moves toward zero. For negative numbers, this means the value technically moves upward (e.g. −3.9 becomes −3).
  • Confusing truncation with floor: Correction — Floor moves toward negative infinity. Truncation moves toward zero.
  • Confusing truncation with ceiling: Correction — Ceiling moves toward positive infinity. Truncation moves toward zero.
  • Forgetting negative numbers move toward zero: Correction — −2.9 truncates to −2, not −3.
  • Using truncation when nearest rounding is required: Correction — Do not use truncation to approximate values; use it only when a hard cutoff is desired.
  • Assuming discarded digits affect the retained digits: Correction — Truncation never adjusts the retained digit based on what was removed.
  • Confusing decimal display formatting with mathematical truncation: Correction — UI components that hide decimals sometimes apply rounding under the hood. Verify your display layer.
  • Using truncation in financial calculations without checking the required rules: Correction — Financial math often mandates standardized rounding rules to avoid destroying value.

Truncation Quick Reference

Truncation toward zero removes the fractional part without rounding the remaining value.

Input Truncate to Whole Number
2.92
2.12
−2.9−2
−2.1−2
55
−5−5

Truncation Practice

Test your knowledge with these examples. Click to reveal the truncated answers.

Truncate 8.765 to 2 decimal places.
8.76
Truncate −8.765 to 2 decimal places.
−8.76
Truncate 9.999 to a whole number.
9
Truncate −9.999 to a whole number.
−9
Truncate 45.6789 to 3 decimal places.
45.678
Truncate 0.005 to 2 decimal places.
0.00
Truncate 100.1 to a whole number.
100
Truncate −3.14159 to 3 decimal places.
−3.141
Truncate 15 / 4 (3.75) to a whole number.
3
Truncate −15 / 4 (−3.75) to a whole number.
−3

Perguntas frequentes

O que é truncamento?
Truncamento é o processo de remoção de dígitos de um número além de uma posição especificada sem arredondar os dígitos restantes.
O que truncar significa em matemática?
Em matemática, truncar um número significa cortar sua parte fracionária, aproximando o valor de zero sem aplicar regras de empate de valor mais próximo.
O que é uma calculadora de números truncados?
Uma calculadora de números truncados é uma ferramenta que remove automaticamente dígitos indesejados de um número com uma precisão especificada, garantindo que nenhum arredondamento ocorra.
Como você trunca um número?
Selecione a posição, mantenha todos os dígitos até aquele ponto, descarte o restante.
O truncamento é redondo?
Não. O truncamento ignora completamente os dígitos descartados.
Diferença entre truncamento e arredondamento?
O arredondamento altera os dígitos retidos com base nos descartados. O truncamento simplesmente elimina dígitos.
O truncamento sempre se move em direção a zero?
Sim, ao truncar decimais, remover a parte fracionária de um número positivo ou negativo sempre aproxima seu valor de zero.
Como funciona o truncamento com números negativos?
Os números negativos movem-se para zero quando truncados. Por exemplo, -3,9 trunca para -3.
Qual é a diferença entre truncamento e piso?
O truncamento se move em direção a zero, enquanto o piso se move em direção ao infinito negativo. Por exemplo, o piso de -2,1 é -3, mas truncar -2,1 resulta em -2.
Qual é a diferença entre truncamento e teto?
O teto se move em direção ao infinito positivo. Truncar 2,1 dá 2, mas o teto de 2,1 é 3.
Você pode truncar para casas decimais?
Sim. Você pode truncar para qualquer casa decimal mantendo o número desejado de dígitos fracionários e removendo o restante.
Como você trunca para 2 casas decimais?
Mantenha os dois primeiros dígitos após a vírgula e remova todo o resto. Por exemplo, 5,6789 torna-se 5,67.
Como você trunca um número em Python?
Use a função math.trunc() do módulo math para truncar um número até zero.
Como você trunca um número em JavaScript?
Use a função Math.trunc() para remover facilmente os dígitos fracionários de um número.
Como você trunca um número no Excel?
Use a função TRUNC, especificando o número e a quantidade desejada de dígitos, como TRUNC(2.987, 2).
Truncar é o mesmo que arredondar para baixo?
Não. O truncamento e o arredondamento para baixo (piso) são diferentes para números negativos. Truncar -2,9 resulta em -2, enquanto arredondar para baixo resulta em -3.
O truncamento pode ser usado para números inteiros?
Sim, se você truncar um número inteiro, ele permanecerá exatamente igual, pois não há dígitos fracionários para remover.