[C ++] filename Detailed cmath

[C ++] filename Detailed cmath

cmath standard library header files c ++ language. Where "c" represents one of the functions from the C standard library, "math" commonly expressed as a mathematical library functions. The main header file declares common mathematical library functions, such as trigonometric functions related to some basic math functions commonly associated. That the math.h header file that contains the.

Absolute value function

  • int abs (int i) Returns the integer absolute value of the parameter i
  • double fabs (double x) returns the absolute value of the parameter x double
  • long labs (long n) returns the absolute value of the parameter n Long
  • double cabs (struct complex znum) seeking the absolute value of the complex

Trigonometric functions

  • double acos (double x) returns the inverse cosine of x arccos (x) value, x is in radians
  • double asin (double x) Returns the arc sine of x arcsin (x) value, x is in radians
  • double atan (double x) returns the arctangent of x arctan (x) value, x is in radians
  • double atan2 (double x, double y) with two parameters arctangent
  • double cos (double x) returns the cosine of x cos (x) value, x is in radians
  • double sin (double x) returns the sine of x sin (x) value, x is in radians
  • double tan (double x) returns the tangent of x Tan (x) value, x is in radians

Power function

  • double fmod (double x, double y); return divided two parameters x / y remainders

  • double sqrt (double x) returns the square root of x

  • double cbrt (double x) cube root of x

Logarithmic function

  • double log (double x) returns the value of logex
  • double log10 (double x) returns the value of log10x
  • Binary double log2 (double x) x log

Exponential function

  • double exp (double x) returns the value of the exponential function e ^ x

  • double exp2 (double x) returns the x th power of 2

  • double pow (double x, double y) returns the value of x ^ y

  • double pow10 (int p) returns the value of 10 ^ p

  • frexp (param, n) binary floating point representation of x = param * 2 ^ n

  • double ldexp (double x, int exp); This function is just the opposite with the above function that frexp function, its return value is x * 2 ^ exp

Return the fraction

  • double modf (double value, double * iptr); split value value, it returns the fractional part, directed iptr integer part (return).

  • double frexp (double value, int * exp); This value is a value of the fractional part f and split into (base 2) of the exponential portion exp, and returns the fractional part of f, i.e., f * 2 ^ exp. Wherein the value of f in the range of 0.5 to 1.0 or 0

ToSei

  • double ceil (double x); take over the entire, returns the smallest integer larger than x
  • double floor (double x); removing the whole, returns the largest integer smaller than x, i.e., a Gaussian function [x]
  • double round (double x) returns the value of x rounded

Most value

  • Maximum double fmax (double x, double y) of the two parameters
  • Minimum of the two parameters double fmin (x, y) in

supplement

  • double hypot (double x, double y); cathetus length of the two known right triangle, the hypotenuse length seek
  • double poly (double x, int degree, double coeffs []); evaluation polynomial
  • int matherr (struct exception * e); mathematical calculation error handler
Published 33 original articles · won praise 7 · views 4533

Guess you like

Origin blog.csdn.net/qq_45239614/article/details/104459170