C + + Common functions

Source: Internet
Author: User
Tags natural logarithm pow square root

Name of function

Format

Function description

Example

Absolute value function

ABS (x)

Find the absolute value of a number X

ABS (-5) =5

Natural number exponential function

EXP (x)

Natural index ex with realistic number X

EXP (1) =2.718282

Rounding down

Floor (x)

Maximum integer not greater than real X

Floor (3.14) =3

Rounding up

Ceil (x)

Minimum integer not less than real X

Ceil (3.14) =4

Natural logarithm function

Log (x)

The natural number logarithm of the realistic number X

Log (1) =0

exponential function

Pow (x, y)

Computes XY with the result of a double-precision real number

Pow (2,3) =8

Random function

RAND ()

Generates a random integer between 0 and Rand-max

 

Square Root Value function

sqrt (x)

The square root of truth-seeking number X

sqrt (25) =5

C + + Common functions

Related Article

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.