search
HomeCommon ProblemWhat is the basic function of int() function

What is the basic function of int() function

#What are the basic functions of the int() function?

INT() function is a type of VFP numerical function, which rounds a real number (which can be a mathematical expression) to be rounded down to the nearest integer. You can use the INT function to return a decimal integer, such as 4.323, which returns 4. It is not rounded, but rounded. Even if 4.987 is 4.987, it returns 4, not 5.

The INT function will return the integer value of the real number rounded down. Its syntax format is INT (number), where number is a real number that needs to be rounded. For example, the return value of INT(8.6) is 8, and the return value of INT(-8.6) is -9. The TRUNC function truncates the decimal part of a number and returns the integer part of the number.

Its syntax format is TRUNC (number, number_digits) , where number is the number that needs to be truncated, number_digits is the number that specifies the rounding precision, and the default is 0. For example, the return value of function TRUNC(8.5) is 8, and the return value of TRUNC(-8.5) is -8.

Although these two functions are rounding functions, their algorithms are different. The INT function returns the integer that is smaller than the given parameter and is closest to the parameter, while the TRUNC function directly returns the integer minus the decimal part.

Function

The int() function is to convert a number or base type string into an integer. INT(x) can find the largest integer not larger than x.

Function

int(x=0)

int(x, base=10), the default value of base is 10, which means that when the value of base is not specified, the function will process x in decimal.

Syntax

The following is the syntax of the int() method:

class int(x, base=10)

Parameters

x —String or number.

base — base number, default decimal.

Return value

Return integer data.

Comments

In some other programming languages, this function is called the "rounding" function.

FIX and CINT functions also complete the rounding function

The above is the detailed content of What is the basic function of int() function. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
ao3 quark entrance official website ao3 official website quark entranceao3 quark entrance official website ao3 official website quark entranceMay 15, 2025 pm 06:45 PM

1. Ao3 official website quark entrance☜☜☜☜☜☜Click to save. 2. Ao3 Quark entrance official website☜☜☜☜☜☜☜Click to save. 【ao3】1. AO3 (Archive of Our Own) is a huge online archive website created by fans. 2. It mainly contains fan works, covering a wide variety of media, from books and movies to TV series and games, almost everything is included. 3. AO3 has rich content and diverse types, which can meet the needs of different readers.

ao3 mirror URL quark ao3 mirror address quark entranceao3 mirror URL quark ao3 mirror address quark entranceMay 15, 2025 pm 06:42 PM

1. Ao3 mirror URL Quark☜☜☜☜☜☜☜☜ Click to enter. 2. Ao3 mirror address quark entrance ☜☜☜☜☜☜☜ Click to enter. 3. AO3 (Archives Our Own) is a non-profit fan and fan-fiction archive website launched on October 29, 2008. 4. AO3 is a website founded by fans and run by fans, dedicated to protecting the works created by fans and providing a censorship-free environment for fan novel writers.

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool