__jquery of common mathematical functions of C + +

Source: Internet
Author: User
Tags mathematical functions pow square root
Math.h/cmath (c + +) Math function library

13 Angle function
Double sin (double);
Double cos (double);
Double tan (double);


2 Inverse Trigonometric Functions
Double asin (double); Results are between [-PI/2,PI/2]
Double ACOs (double); Results between [0, PI]
Double Atan (double); Tangent (primary), the result is between [-PI/2,PI/2]
Double atan2 (double, double); Tangent (integer circle value), the result is between [-PI/2,PI/2]


3 Hyperbolic trigonometric Functions
Double Sinh (double);
Double cosh (double);
Double Tanh (double);

4 exponent and logarithm

Double exp (double);
Double pow (double, double);   Double pow (double base, double exponent);         Long double pow (long double base, long double exponent);        Float POW (float base, float exponent);   Double pow (double base, int exponent); Long double pow (long double base, int exponent);
Double sqrt (double);
Double log (double); Logarithm with e as the base
Double log10 (double); Ln=log (n), log10 (n)

But there is no 2-based function. You can use the formula to solve: log2 (n) =log10 (n)/log10 (2). VS2010, log (243.0)/log (3.0), the calculated result is actually 4, the answer is wrong. Sometimes I use the log (243.0+0.1)/log (3.0) in this format to take the logarithm.


5 rounding
Double ceil (double); Take the whole
Double floor (double); Remove the whole

6 absolute Value
Double fabs (double);

7 Standardized floating-point numbers
Double Frexp (double f, int *p); Standard floating-point number, F = x *2^p, known F for X, p (x between [0.5, 1])
Double Ldexp (double x, int p); In contrast to Frexp, known as x, P F

8 Rounding and fetching
Double Modf (double, double*); Returns the integer part of the parameter by the pointer, returning the decimal part
Double Fmod (double, double); Returns the remainder of the divide between two parameters


9 square root
Double sqrt (double x);   float sqrt (float x); Long double sqrt (long double x);

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.