# Truncate (Number)

Pronunciation: /ˈtrʌŋ.keɪt/ Explain

A number is truncated by removing digits[3]. For example, truncating the number 14.784 to three digits yields 14.7. Note that truncating is not the same as rounding.

NumberTruncate to
digits
Truncated
Number
14.87482110
14.87482214
14.87482314.8
14.87482414.87
14.87482514.8748
14.87482614.87482
Table 1: Truncation examples

In computer languages, to truncate means to convert a floating point or decimal number to an integer[3]. The following code truncates the floating point number 3.62 to the integer 3 and prints '3'.

`float num1 = 3.62;integer num2 = trunc(num1);print num2`

The following code truncates a floating point number 7.2832 to two decimal places and prints '7.28'.

```float num1 = 7.2832;float num2 = trunc(num1 * 100.0) / 100.0; print num2;```

### References

1. McAdams, David E.. All Math Words Dictionary, truncate (number). 2nd Classroom edition 20150108-4799968. pg 183. Life is a Story Problem LLC. January 8, 2015. Buy the book
2. truncate. merriam-webster.com. Merriam-Webster Online Dictionary. Merriam-Webster. Last Accessed 12/26/2018. https://www.merriam-webster.com/dictionary/truncate. Buy the book
3. Decimal Truncate Method. MSDN Library. Microsoft. Last Accessed 12/16/2018. http://msdn.microsoft.com/en-us/library/system.decimal.truncate.aspx.