Numerical operations and arithmetic operation functions

Source: Internet
Author: User
Tags natural logarithm

There is no data operation missing from the program, the following is an introduction to the operators supported by ABAP.

(1) Arithmetic operators

Arithmetic operators have + (plus),-(minus), * (multiply),/(except), DIV (divisible), MOD (remainder), * * (exponentiation).

The basic format of the operator is:

[COMPUTE] n=<mathematical expression>.

There must be a space between the operator and the variable to implement the addition language of a variable as follows:

Data:int TYPE I.
COMPUTE int = int + 10.
int = int + 10.
ADD ten to Int.

(2) Comparison operators

Comparison operators have EQ or = (equals), NE or <> (not equal), lt or < (less than), GT or > (greater than), le or <= (less than or equal), GE, or >= (greater than or equal to).

(3) Logical operators

logical operators Have and (and), or (or), not (non).

(4) Arithmetic operation function

The functions included in ABAP are shown in the following table:

Name of function Description
Abs Returns the absolute value of the input parameter
Sign Returns the symbol for the input parameter: positive return 1,0 return 0, negative number returned-1
Ceil Returns the smallest integer not less than the input parameter
Floor Returns the largest integer not greater than the input parameter
TRUNC Returns the integer portion of an input parameter
TRAC Returns the number of decimal parts of an input parameter
ACOS (X) Inverse cosine function, the result range is [-pi/2,pi/2],x range of from[-1,1] (PI for trigonometric functions: 3.14)
ASIN (X) Inverse chord function, the result range is [0,pi],x range of from[-1,1]
ATAN The inverse tangent function, the result range is [-PI/2,PI/2]
COS cosine function
SIN sine function
TAN Tangent function
COSH Cosine curve function
SINH sinusoidal function
TANH Tangent curve function
BX7 The curtain function of the base e (2=2.7182818284590452)
LOG The natural logarithm of the base E
LOG10 Logarithm of base 10
SQRT Square root
STRLEN Get string length function

The following is an instance of a function call:

     DATA TYPE TYPE TYPE I,      TYPE TYPE F,   word1 (ten), Word2 (+),   TYPE  xstring.
    = (i1+exp (f2)) * I2/sin (3 - i3).      COMPUTE * i3) + F2).      = STRLEN (word1) + STRLEN (WORD2).

Numerical operations and arithmetic operation functions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.