Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

What are the commonly used mathematical functions in C language?

Shulou Source: shulou.com Published: 2022-06-01 07:09:45 11月13日 Update

This article mainly introduces what is the commonly used mathematical function in C language, which has a certain reference value. Interested friends can refer to it. I hope you will gain a lot after reading this article.

Mathematical function

Mathematical operation is a frequently used form of operation in computer programs. in addition to the basic arithmetic operators, C language provides nearly 100 standard functions of commonly used mathematical operations in its standard function library to facilitate the use of programs. This section introduces several commonly used mathematical functions. For more mathematical functions, please see Appendix and other materials. Most mathematical function prototypes are declared in the header file math.h and are programmed with the following file containing instructions at the beginning of the program:

# include

Commonly used mathematical functions

1. Commonly used absolute value class functions

Int abs (int n) finds the absolute value of int type data, which is declared in stdlib.h

Double fabs (double n) to find the absolute value of double type data

two。 Commonly used trigonometric functions

Double sin (double x) to find the value of sine function

Double cos (double x) calculates cosine function values

3. Exponential, logarithmic and square root functions

Double pow (double x, double y) finds the y power of x, that is, xy

Double log (double x) to find the natural logarithm of x

Double log10 (double x) to find the base 10 logarithm of x

Double sqrt (double x) to find the square root of x

The logical structure of the program

A C program is composed of two parts: the data structure and the algorithm, in which the data structure is used to describe the data processed in the program, and the algorithm is used to describe the data processing method.

The description of data is realized by the definition of data type, and the basic implementation unit of algorithm description is C sentence.

Thank you for reading this article carefully. I hope the article "what are the mathematical functions commonly used in C language" shared by the editor will be helpful to everyone? at the same time, I also hope that you will support and pay attention to the industry information channel. more related knowledge is waiting for you to learn!

Tags: Functions mathematics data common use programs operations articles languages logarithms algorithms types structures absolute values parts square roots data structures files more standards processing Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information Xiaomi Linux MySQL OPPO Reno