Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the basic functions of the int () function

2025-04-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

This article will explain in detail what the basic functions of the int () function are, and the content of the article is of high quality, so the editor will share it with you for reference. I hope you will have some understanding of the relevant knowledge after reading this article.

The INT () function, one of the VFP numeric functions, rounds down a real number to be rounded (which can be a mathematical expression) to the nearest integer. Using the INT function, you can return a decimal integer, such as 4.323 and 4, which is not rounded, but tailed. Even if 4.987, it returns 4 instead of 5.

The INT function returns 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, while that of INT (- 8.6) is-9. The TRUNC function truncates the decimal part of the number and returns the integer part of the number.

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

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

Function

The int () function converts a string of type base or number to an integer. INT (x) can find a maximum integer not greater than x.

Function

Int (xan0)

Int (x, base=10), the default value of base is 10, that is, when the value of base is not specified, the function treats x as decimal.

Grammar

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

Class int (x, base=10)

Parameters.

X-string or number.

Base-Decimal number, default to decimal.

Return value

Returns integer data.

Annotation

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

FIX and CINT functions also complete the rounding function.

The basic functions of the int () function are shared here. I hope the above content can be of some help to you and can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report