06--c Language Mathematical functions

Source: Internet
Author: User
Tags acos asin cos log e mathematical functions pow sin square root

When using the C-language math function, you should use the following command line in the source file:

#include <math.h> or #include "math.h", here <> and "" respectively, the former means that the system to the directory where the C library function header files are located to find the files that need to be included, this is the standard way The latter indicates that the system first looks for the files to be included in the current directory, if it is not found, and then finds them by the former. To save time, you use "" in your own files, and the files you write are typically in the current directory.

32 Mathematical functions only ABS data type is: "integer", "int".

The 10 and E in Log10, Loge are located in the lower-left corner of the log. The rest of the ARC function needs to see if it is exponential.

The arrangement is as follows: Function name: function function parameter introduction, return value, description. Function prototypes.

ABS: calculates the absolute value of integer x and returns the result of the calculation. int ABS (int x);

ACOs: calculates the value of COS-1 (x), returns the result of the calculation, and X should be within the range of-1 to 1. Double ACOs (double x);

ASIN: calculates the value of SIN-1 (x), returns the result of the calculation, and X should be within the range of-1 to 1. Double asin (double x);

Atan: calculates the value of TAN-1 (x) and returns the result of the calculation. Double Atan (double x);

atan2: calculates the value of tan-1/(x/y) and returns the result of the calculation. Double atan2 (double x,double y);

cos: calculates the value of the cos (x), returns the calculated result, and x in radians. double cos (double x);

cosh: calculates the value of X's hyperbolic cosine cosh (x) and returns the result of the calculation. double cosh (double x);

Exp: calculates the value of ex and returns the result of the calculation. double exp (double x);

fabs: calculates the absolute value of x and returns the result of the calculation. duoble fabs (fouble x);

Floor : Find the largest integer not greater than X, which returns the double-precision real number of the integer. double floor (double x);

fmod: to divide the remainder of x/Y and return the double precision of the remainder. double fmod (double x,double y);

frexp: The double number Val is decomposed into a number part (Mantissa) x and an exponent N of 2, that is, Val=x*2n,n is stored in the variable that the eptr points to. Returns the number part x0.5<=x<1. Double Frexp (double x, double *eptr);

log: ask for log e x,in x. Returns the result of the calculation. double log (double x);

log10: Beg log10x. Returns the result of the calculation. double log10 (double x);

MODF: The double number Val is decomposed into integral parts and fractional parts, and the integer part is stored in the unit pointed to by Iptr. Returns the number of decimal parts of Val. double modf (double val,double *iptr);

POW: calculates the value of XY and returns the result of the calculation. Double pow (double x,double *iprt);

Rand: generates a random integer between 90 and 32767. Returns a random integer. int rand (void);

sin: calculates the value of the Sinx. Returns the result of the calculation. x units are radians. double sin (double x);

Sinh: calculates the value of X's hyperbolic sine function sinh (x) and returns the result of the calculation. double Sinh (double x);

sqrt: calculates the square root x. Returns the result of the calculation. X should be >=0. double sqrt (double x);

Tan: calculates the value of tan (x) and returns the result of the calculation. x units are radians. Double tan (double x);

Tanh: calculates the value of the hyperbolic tangent function of x tanh (x). Returns the result of the calculation. Double Tanh (double x);

06--c Language Mathematical 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.