C Library Mac Math.h

22 rows  C Library - math.h - The math.h header defines various mathematical functions and one macro. All the functions available in this library take double as an argument and return double. The math.h header shall define the following macros: HUGEVAL A positive double constant expression, not necessarily representable as a float. Used as an error value returned by the mathematics library. HUGEVAL evaluates to +infinity on systems supporting IEEE Std 754‐1985. Oct 01, 2016  On both the PC and the Mac, the math library is included in the standard C library — at least it appears so. Otherwise, the compiler automatically calls in the library. But in Linux, apparently, you must manually specify that the linker include the math library. But isn’t the math library included with #include h No!

I downloaded the Developers tools yesterday and have them installed and working fine with OSX PB. However, I can't for the life of me locate the C math library 'libm'. Its discussed in man and math.h is in the include directory. I can find most of the other common libraries, but no libm.a. 'locate libm' does find what looks like a Java libmath library. Has 'libm' taken on a unique name for OSX (likely e.g. on an alpha libcpml is an optimized subsitutute for libm) or has it not been ported (very unlikely). I've made it thru compile without errors, built a special tools library, and would just like to link which needs libm. This code is for a optical deconvolution package for computaional optical sectioning micrsocopy that I've used on SGI's and alphaLinux and LinuxPPC platforms. Thanks.
  • The C Standard Library

C Programming Math Library

  • C Standard Library Resources
  • C Programming Resources

C Language Math Library

  • Selected Reading

C programming math library

The math.h header defines various mathematical functions and one macro. All the functions available in this library take double as an argument and return double as the result.

Library Macros

There is only one macro defined in this library −

Sr.No.Macro & Description
1

HUGE_VAL

This macro is used when the result of a function may not be representable as a floating point number. If magnitude of the correct result is too large to be represented, the function sets errno to ERANGE to indicate a range error, and returns a particular, very large value named by the macro HUGE_VAL or its negation (- HUGE_VAL).

If the magnitude of the result is too small, a value of zero is returned instead. In this case, errno might or might not be set to ERANGE.

Library Functions

Following are the functions defined in the header math.h −

C language math library
Sr.No.Function & Description
1double acos(double x)

Returns the arc cosine of x in radians.

2double asin(double x)

Returns the arc sine of x in radians.

3double atan(double x)

Returns the arc tangent of x in radians.

4double atan2(double y, double x)

Returns the arc tangent in radians of y/x based on the signs of both values to determine the correct quadrant.

5double cos(double x)

Returns the cosine of a radian angle x.

6double cosh(double x)

Returns the hyperbolic cosine of x.

7double sin(double x)

Returns the sine of a radian angle x.

8double sinh(double x)

Returns the hyperbolic sine of x.

9double tanh(double x)

Returns the hyperbolic tangent of x.

10double exp(double x)

Returns the value of e raised to the xth power.

11double frexp(double x, int *exponent)

The returned value is the mantissa and the integer pointed to by exponent is the exponent. The resultant value is x = mantissa * 2 ^ exponent.

12double ldexp(double x, int exponent)

Returns x multiplied by 2 raised to the power of exponent.

13double log(double x)

Returns the natural logarithm (base-e logarithm) of x.

14double log10(double x)

Returns the common logarithm (base-10 logarithm) of x.

15double modf(double x, double *integer)

The returned value is the fraction component (part after the decimal), and sets integer to the integer component.

16double pow(double x, double y)

Returns x raised to the power of y.

17double sqrt(double x)

Returns the square root of x.

18double ceil(double x)

Returns the smallest integer value greater than or equal to x.

19double fabs(double x)

Returns the absolute value of x.

20double floor(double x)

Returns the largest integer value less than or equal to x.

21double fmod(double x, double y)

Returns the remainder of x divided by y.