Home : Technical Terms : Truncate Definition

Truncate

To truncate something is to shorten it, or cut part of it off. In computer science, the term is often used in reference to data types or variables, such as floating point numbers and strings.

For example, a function may truncate the decimal portion of a floating point number to make it an integer. If the number 3.875 is truncated, it becomes 3. Note that this is different than if the number had been rounded to the nearest integer, which would be 4. Strings may also be truncated, which can be useful if a string exceeds the maximum character limit for a certain application.

Several programming languages use the function trunc() to truncate a variable. PHP uses strlen() to truncate a string to a set limit of characters.

Cite this definition:

https://techterms.com/definition/truncate

TechTerms - The Tech Terms Computer Dictionary

This page contains a technical definiton of Truncate. It explains in computing terminology what Truncate means and is one of many technical terms in the TechTerms dictionary.

All definitions on the TechTerms website are written to be technically accurate but also easy to understand. If you find this Truncate definition to be helpful, you can reference it using the citation links above. If you think a term should be updated or added to the TechTerms dictionary, please email TechTerms!