RETURN VALUE The acos() function returns the arc cosine in radians and the value is mathematically defined to be between 0 and PI (inclusive).

Size: px
Start display at page:

Download "RETURN VALUE The acos() function returns the arc cosine in radians and the value is mathematically defined to be between 0 and PI (inclusive)."

Transcription

1 ACOS(3) Linux Programmer s Manual ACOS(3) acos, acosf, acosl arc cosine function double acos(double x); float acosf(float x); long double acosl(long double x); The acos() function calculates the arc cosine of x; that is the value whose cosine is x. If x falls outside the range 1 to 1, acos() fails and errno is set. RETURN VALUE The acos() function returns the arc cosine in radians and the value is mathematically defined to be between 0 and PI (inclusive). ERRORS EDOM x is out of range. CONFORMING TO SVID 3, POSIX, BSD 4.3, ISO The float and long double variants are C99 requirements. asin(3), atan(3), atan2(3), cos(3), sin(3), tan(3)

2 ACOSH(3) Linux Programmer s Manual ACOSH(3) acosh, acoshf, acoshl inverse hyperbolic cosine function double acosh(double x); float acoshf(float x); long double acoshl(long double x); The acosh() function calculates the inverse hyperbolic cosine of x; that is the value whose hyperbolic cosine is x. Ifx is less than 1.0, acosh() returns not-a-number (NaN) and errno is set. ERRORS EDOM x is out of range. CONFORMING TO SVID 3, POSIX, BSD 4.3, ISO The float and long double variants are C99 requirements. asinh(3), atanh(3), cosh(3), sinh(3), tanh(3)

3 ASIN(3) Linux Programmer s Manual ASIN(3) asin, asinf, asinl arc sine function double asin(double x); float asinf(float x); long double asinl(long double x); The asin() function calculates the arc sine of x; that is the value whose sine is x. If x falls outside the range 1 to 1, asin() fails and errno is set. RETURN VALUE The asin() function returns the arc sine in radians and the value is mathematically defined to be between -PI/2 and PI/2 (inclusive). ERRORS EDOM x is out of range. CONFORMING TO SVID 3, POSIX, BSD 4.3, ISO The float and long double variants are C99 requirements. acos(3), atan(3), atan2(3), cos(3), sin(3), tan(3)

4 ASINH(3) Linux Programmer s Manual ASINH(3) asinh, asinhf, asinhl inverse hyperbolic sine function double asinh(double x); float asinhf(float x); long double asinhl(long double x); The asinh() function calculates the inverse hyperbolic sine of x; that is the value whose hyperbolic sine is x. CONFORMING TO SVID 3, POSIX, BSD 4.3, ISO The float and long double variants are C99 requirements. acosh(3), atanh(3), cosh(3), sinh(3), tanh(3)

5 AT AN(3) Linux Programmer s Manual ATAN(3) atan, atanf, atanl arc tangent function double atan(double x); float atanf(float x); long double atanl( long double x); The atan() function calculates the arc tangent of x; that is the value whose tangent is x. RETURN VALUE The atan() function returns the arc tangent in radians and the value is mathematically defined to be between -PI/2 and PI/2 (inclusive). CONFORMING TO SVID 3, POSIX, BSD 4.3, ISO The float and long double variants are C99 requirements. acos(3), asin(3), atan2(3), cos(3), sin(3), tan(3)

6 AT AN2(3) Linux Programmer s Manual ATAN2(3) atan2, atan2f, atan2l arc tangent function of two variables double atan2(double y, double x); float atan2f(float y, float x); long double atan2l(long double y, long double x); The atan2() function calculates the arc tangent of the two variables x and y. It is similar to calculating the arc tangent of y / x, except that the signs of both arguments are used to determine the quadrant of the result. RETURN VALUE The atan2() function returns the result in radians, which is between -PI and PI (inclusive). CONFORMING TO SVID 3, POSIX, BSD 4.3, ISO The float and long double variants are C99 requirements. acos(3), asin(3), atan(3), cos(3), sin(3), tan(3)

7 AT ANH(3) Linux Programmer s Manual ATANH(3) atanh, atanhf, atanhl inverse hyperbolic tangent function double atanh(double x); float atanhf(float x); long double atanhl(long double x); The atanh() function calculates the inverse hyperbolic tangent of x; that is the value whose hyperbolic tangent is x. If the absolute value of x is greater than 1.0, acosh() returns not-a-number (NaN) and errno is set. ERRORS EDOM x is out of range. CONFORMING TO SVID 3, POSIX, BSD 4.3, ISO The float and long double variants are C99 requirements. asinh(3), acosh(3), cosh(3), sinh(3), tanh(3)

8 CBRT(3) Linux Programmer s Manual CBRT(3) cbrt, cbrtf, cbrtl cube root function double cbrt(double x); float cbrtf(float x); long double cbrtl(long double x); The cbrt() function returns the (real) cube root of x. This function cannot fail; every representable real value has a representable real cube root. CONFORMING TO cbrt() was a GNU extension. It is now a C99 requirement. sqrt(3), pow(3) GNU

9 CEIL(3) Linux Programmer s Manual CEIL(3) ceil, ceilf, ceill ceiling function: smallest integral value not less than argument double ceil(double x); float ceilf(float x); long double ceill(long double x); These functions round x up to the nearest integer. RETURN VALUE The rounded integer value. If x is integral or infinite, x itself is returned. ERRORS No errors other than EDOM and ERANGE can occur. If x is NaN, then NaN is returned and errno may be set to EDOM. NOTES SUSv2 and POSIX contain text about overflow (which might set errno to ERANGE, or raise an exception). In practice, the result cannot overflow on any current machine, so this error-handling stuff is just nonsense. (More precisely, overflow can happen only when the maximum value of the exponent is smaller than the number of mantissa bits. For the IEEE-754 standard 32-bit and 64-bit floating point numbers the maximum value of the exponent is 128 (resp. 1024), and the number of mantissa bits is 24 (resp. 53).) CONFORMING TO The ceil() function conforms to SVID 3, POSIX, BSD 4.3, ISO The other functions are from C99. floor(3), lrint(3), nearbyint(3), rint(3), round(3), trunc(3)

10 COPYSIGN(3) Linux Programmer s Manual COPYSIGN(3) copysign, copysignf, copysignl copy sign of a number double copysign(double x, double y); float copysignf(float x, float y); long double copysignl(long double x, long double y); The copysign() functions return a value whose absolute value matches that of x, but whose sign matches that of y. Ifx is a NaN, then a NaN with the sign of y is returned. NOTES The copysign() functions may treat a negative zero as positive. CONFORMING TO C99, BSD 4.3. This function is defined in IEC 559 (and the appendix with recommended functions in IEEE 754/IEEE 854). signbit(3) GNU

11 COS(3) Linux Programmer s Manual COS(3) cos, cosf, cosl cosine function double cos(double x); float cosf(float x); long double cosl(long double x); The cos() function returns the cosine of x, where x is given in radians. RETURN VALUE The cos() function returns a value between 1 and 1. CONFORMING TO SVID 3, POSIX, BSD 4.3, ISO The float and the long double variants are C99 requirements. acos(3), asin(3), atan(3), atan2(3), sin(3), tan(3)

12 COSH(3) Linux Programmer s Manual COSH(3) cosh, coshf, coshl hyperbolic cosine function double cosh(double x); float coshf(float x); long double coshl(long double x); The cosh() function returns the hyperbolic cosine of x, which is defined mathematically as (exp(x) + exp(-x)) / 2. CONFORMING TO SVID 3, POSIX, BSD 4.3, ISO 9899 (C99). The float and the long double variants are C99 requirements. acosh(3), asinh(3), atanh(3), sinh(3), tanh(3)

13 ERF(3) Linux Programmer s Manual ERF(3) erf, erff, erfl, erfc, erfcf, erfcl error function and complementary error function double erf(double x); float erff(float x); long double erfl(long double x); double erfc(double x); float erfcf(float x); long double erfcl(long double x); The erf() function returns the error function of x; defined as erf(x) = 2/sqrt(pi)* integral from 0 to x of exp(-t*t) dt The erfc() function returns the complementary error function of x, that is erf(x). CONFORMING TO SVID 3, BSD 4.3, C99. The float and long double variants are requirements of C99. exp(3) BSD

14 EXP(3) Linux Programmer s Manual EXP(3) exp, expf, expl base-e exponential function double exp(double x); float expf(float x); long double expl(long double x); The exp() function returns the value of e (the base of natural logarithms) raised to the power of x. CONFORMING TO SVID 3, POSIX, BSD 4.3, ISO The float and the long double variants are C99 requirements. sqrt(3), cbrt(3) exp10(3), exp2(3)

15 EXPM1(3) Linux Programmer s Manual EXPM1(3) expm1, expm1f, expm1l exponential minus 1 double expm1(double x); float expm1f(float x); long double expm1l(long double x); expm1(x) returns a value equivalent to exp (x) - 1. It is computed in a way that is accurate even if the value of x is near zero--a case where exp (x) - 1 would be inaccurate due to subtraction of two numbers that are nearly equal. CONFORMING TO BSD, C99. The float and the long double variants are C99 requirements. exp(3), log(3), log1p(3)

16 FABS(3) Linux Programmer s Manual FABS(3) fabs, fabsf, fabsl absolute value of floating-point number double fabs(double x); float fabsf(float x); long double fabsl(long double x); The fabs functions return the absolute value of the floating-point number x. ERRORS No errors can occur. CONFORMING TO The fabs() function conforms to SVID 3, POSIX, BSD 4.3, ISO The other functions are from C99. abs(3), ceil(3), floor(3), labs(3), rint(3)

17 FLOOR(3) Linux Programmer s Manual FLOOR(3) floor, floorf, floorl largest integral value not greater than argument double floor(double x); float floorf(float x); long double floorl(long double x); These functions round x down to the nearest integer. RETURN VALUE The rounded integer value. If x is integral or infinite, x itself is returned. ERRORS No errors other than EDOM and ERANGE can occur. If x is NaN, then NaN is returned and errno may be set to EDOM. NOTES SUSv2 and POSIX contain text about overflow (which might set errno to ERANGE, or raise an exception). In practice, the result cannot overflow on any current machine, so this error-handling stuff is just nonsense. (More precisely, overflow can happen only when the maximum value of the exponent is smaller than the number of mantissa bits. For the IEEE-754 standard 32-bit and 64-bit floating point numbers the maximum value of the exponent is 128 (resp. 1024), and the number of mantissa bits is 24 (resp. 53).) CONFORMING TO The floor() function conforms to SVID 3, POSIX, BSD 4.3, ISO The other functions are from C99. ceil(3), lrint(3), nearbyint(3), rint(3), round(3), trunc(3)

18 FMOD(3) Linux Programmer s Manual FMOD(3) fmod, fmodf, fmodl floating-point remainder function double fmod(double x, double y); float fmodf(float x, float y); long double fmodl(long double x, long double y); The fmod() function computes the remainder of dividing x by y. The return value is x - n * y, where n is the quotient of x / y, rounded towards zero to an integer. RETURN VALUE The fmod() function returns the remainder, unless y is zero, when the function fails and errno is set. ERRORS EDOM The denominator y is zero. CONFORMING TO SVID 3, POSIX, BSD 4.3, ISO The float and the long double variants are C99 requirements. remainder(3)

19 FREXP(3) Linux Programmer s Manual FREXP(3) frexp, frexpf, frexpl convert floating-point number to fractional and integral components double frexp(double x, int *exp); float frexpf(float x, int *exp); long double frexpl(long double x, int *exp); The frexp() function is used to split the number x into a normalized fraction and an exponent which is stored in exp. RETURN VALUE The frexp() function returns the normalized fraction. If the argument x is not zero, the normalized fraction is x times a power of two, and is always in the range 1/2 (inclusive) to 1 (exclusive). If x is zero, then the normalized fraction is zero and zero is stored in exp. CONFORMING TO SVID 3, POSIX, BSD 4.3, ISO The float and the long double variants are C99 requirements. EXAMPLE #include <stdio.h> #include <float.h> int main () { double d = 2560; int e; double f = frexp(d, &e); printf("frexp(%g, &e) = %g: %g * %dˆ%d = %g\n", d, f, f, FLT_RADIX, e, d); return 0; } This program prints frexp(2560, &e) = 0.625: * 2ˆ12 = 2560 ldexp(3), modf(3)

20 GAMMA(3) libc math functions GAMMA(3) gamma, gammaf, gammal (logarithm of the) gamma function double gamma(double x); float gammaf(float x); long double gammal(long double x); For the definition of the Gamma function, see tgamma(3). *BSD version 4.4BSD and FreeBSD libm have a gamma() function that computes the Gamma function, as one would expect. glibc version Glibc has a gamma() function that is equivalent to lgamma() and computes the natural logarithm of the Gamma function. (This is for compatibility reasons only. Don t use this function.) HISTORY 4.2BSD had a gamma() that computed ln( Gamma( x ) ), leaving the sign of Gamma( x ) in the external integer signgam. In 4.3BSD the name was changed to lgamma(), and the man page promises "At some time in the future the name gamma will be rehabilitated and used for the Gamma function" This did indeed happen in 4.4BSD, where gamma() computes the Gamma function (with no effect on signgam). However, this came too late, and we now hav e tgamma(), the "true gamma" function. CONFORMING TO 4.2BSD. Compatible with previous mistakes. lgamma(3), signgam(3), tgamma(3) GNU

21 HYPOT(3) Linux Programmer s Manual HYPOT(3) hypot, hypotf, hypotl Euclidean distance function double hypot(double x, double y); float hypotf(float x, float y); long double hypotl (long double x, long double y); The hypot() function returns sqrt(x*x+y*y). This is the length of the hypotenuse of a right-angle triangle with sides of length x and y, or the distance of the point (x,y) from the origin. CONFORMING TO SVID 3, BSD 4.3, C99. The float and the long double variants are C99 requirements. sqrt(3), cabs(3)

22 ISINF(3) Linux Programmer s Manual ISINF(3) isinf, isnan, finite test for infinity or not-a-number (NaN) int isinf(double value); int isnan(double value); int finite(double value); The isinf() function returns 1 if value represents negative infinity, 1 if value represents positive infinity, and 0 otherwise. The isnan() function returns a non-zero value if value is "not-a-number" (NaN), and 0 otherwise. The finite() function returns a non-zero value if value is neither infinite nor a "not-a-number" (NaN) value, and 0 otherwise. NOTE C99 provides additional macros, such as the type-independent fpclassify(), isinf() and isnan(). CONFORMING TO BSD 4.3 fpclassify(3)

23 J0(3) Linux Programmer s Manual J0(3) j0, j0f, j0l, j1, j1f, j1l, jn, jnf, jnl, y0, y0f, y0l, y1, y1f, y1l, yn, ynf, ynl Bessel functions double j0(double x); double j1(double x); double jn(int n, double x); double y0(double x); double y1(double x); double yn(int n, double x); float j0f(float x); float j1f(float x); float jnf(int n, float x); float y0f(float x); float y1f(float x); float ynf(int n, float x); long double j0l(long double x); long double j1l(long double x); long double jnl(int n, long double x); long double y0l(long double x); long double y1l(long double x); long double ynl(int n, long double x); The j0() and j1() functions return Bessel functions of x of the first kind of orders 0 and 1, respectively. The jn() function returns the Bessel function of x of the first kind of order n. The y0() and y1() functions return Bessel functions of x of the second kind of orders 0 and 1, respectively. The yn() function returns the Bessel function of x of the second kind of order n. For the functions y0(), y1() and yn(), the value of x must be positive. For negative values of x, these functions return HUGE_VAL. The j0f() etc. and j0l() etc. functions are versions that take and return float and long double values, respectively. CONFORMING TO The functions returning double conform to SVID 3, BSD 4.3, XPG4, POSIX The other functions are C99 requirements. BUGS There are errors of up to 2e 16 in the values returned by j0(), j1() and jn() for values of x between 8 and

24 LDEXP(3) Linux Programmer s Manual LDEXP(3) ldexp, ldexpf, ldexpl multiply floating-point number by integral power of 2 double ldexp(double x, int exp); float ldexp(float x, int exp); long double ldexp(long double x, int exp); The ldexp() function returns the result of multiplying the floating-point number x by 2 raised to the power exp. CONFORMING TO SVID 3, POSIX, BSD 4.3, ISO The float and the long double variants are C99 requirements. frexp(3), modf(3)

25 LGAMMA(3) Linux Programmer s Manual LGAMMA(3) lgamma, lgammaf, lgammal, lgamma_r, lgammaf_r, lgammal_r log gamma function double lgamma(double x); float lgammaf(float x); long double lgammal(long double x); double lgamma_r(double x, int *signp); float lgammaf_r(float x, int *signp); long double lgammal_r(long double x, int *signp); For the definition of the Gamma function, see tgamma(3). The lgamma() function returns the natural logarithm of the absolute value of the Gamma function. The sign of the Gamma function is returned in the external integer signgam declared in <math.h>. It is 1 when the Gamma function is positive or zero, 1 when it is negative. Since using a constant location signgam is not thread-safe, the functions lgamma_r() etc. have been introduced; they return this sign via the parameter signp. For nonpositive integer values of x, lgamma() returns HUGE_VAL, sets errno to ERANGE and raises the zero divide exception. (Similarly, lgammaf() returns HUGE_VALF and lgammal() returns HUGE_VALL.) ERRORS An application wishing to check for error situations should set errno to zero and call feclearexcept(fe_all_except) before calling these functions. On return, if errno is non-zero or fetestexcept(fe_invalid FE_DIVBYZERO FE_OVERFLOW FE_UNDERFLOW) is non-zero, an error has occurred. A range error occurs if x is too large. A pole error occurs if x is a negative integer or zero. CONFORMING TO C99, SVID 3, BSD 4.3 tgamma(3)

26 EXP(3) Linux Programmer s Manual EXP(3) log, logf, logl natural logarithmic function double log(double x); float logf(float x); long double logl(long double x); The log() function returns the natural logarithm of x. ERRORS The log() function can return the following errors: EDOM The argument x is negative. ERANGE The argument x is zero. The log of zero is not defined (minus infinity). CONFORMING TO SVID 3, POSIX, BSD 4.3, ISO The float and the long double variants are C99 requirements. sqrt(3), cbrt(3)

27 EXP(3) Linux Programmer s Manual EXP(3) log10, log10f, log10l base-10 logarithmic function double log10(double x); float log10f(float x); long double log10l(long double x); The log10() function returns the base 10 logarithm of x. ERRORS The log10() function can return the following errors: EDOM The argument x is negative. ERANGE The argument x is zero. The log of zero is not defined. CONFORMING TO SVID 3, POSIX, BSD 4.3, ISO The float and the long double variants are C99 requirements. sqrt(3), cbrt(3)

28 LOG1P(3) Linux Programmer s Manual LOG1P(3) log1p logarithm of 1 plus argument double log1p(double x); float log1pf(float x); long double log1pl(long double x); log1p(x) returns a value equivalent to log (1 + x). It is computed in a way that is accurate even if the value of x is near zero. CONFORMING TO BSD, C99. The float and the long double variants are C99 requirements. exp(3), log(3), expm1(3)

29 MODF(3) Linux Programmer s Manual MODF(3) modf, modff, modfl extract signed integral and fractional values from floating-point number double modf(double x, double *iptr); float modff(float x, float *iptr); long double modfl(long double x, long double *iptr); The modf() function breaks the argument x into an integral part and a fractional part, each of which has the same sign as x. The integral part is stored in iptr. RETURN VALUE The modf() function returns the fractional part of x. CONFORMING TO SVID 3, POSIX, BSD 4.3, ISO The float and the long double variants are C99 requirements. frexp(3), ldexp(3)

30 NEXTAFTER(3) libc math functions NEXTAFTER(3) nextafter, nextafterf, nextafterl, nexttoward, nexttowardf, nexttowardl floating point number manipulation double nextafter(double x, double y); float nextafterf(float x, float y); long double nextafterl(long double x, long double y); double nexttoward(double x, long double y); float nexttowardf(float x, long double y); long double nexttowardl(long double x, long double y); The nextafter() functions return the next representable neighbor of x in the direction towards y. The size of the step between x and the result depends on the type of the result. If x = y the function simply returns y. If either value is NaN, then NaN is returned. Otherwise a value corresponding to the value of the least significant bit in the mantissa is added or subtracted, depending on the direction. The nexttoward() functions do the same as the nextafter() functions, except that they hav e a long double second argument. These functions will signal overflow or underflow if the result goes outside of the range of normalized numbers. CONFORMING TO C99. This function is defined in IEC 559 (and the appendix with recommended functions in IEEE 754/IEEE 854). nearbyint(3) GNU

31 POW(3) Linux Programmer s Manual POW(3) pow, powf, powl power functions double pow(double x, double y); float powf(float x, float y); long double powl(long double x, long double y); The pow() function returns the value of x raised to the power of y. ERRORS The pow() function can return the following error: EDOM The argument x is negative and y is not an integral value. This would result in a complex number. CONFORMING TO SVID 3, POSIX, BSD 4.3, ISO The float and the long double variants are C99 requirements. sqrt(3), cbrt(3)

32 REMAINDER(3) Linux Programmer s Manual REMAINDER(3) drem, dremf, dreml, remainder, remainderf, remainderl floating-point remainder function /* The C99 versions */ double remainder(double x, double y); float remainderf(float x, float y); long double remainderl(long double x, long double y); /* Obsolete synonyms */ double drem(double x, double y); float dremf(float x, float y); long double dreml(long double x, long double y); Link with lm. The remainder() function computes the remainder of dividing x by y. The return value is x - n * y, where n is the value x / y, rounded to the nearest integer. If this quotient is 1/2, it is rounded to the nearest even number (independent of the current rounding mode). If the return value is 0, it has the sign of x. The drem() function does precisely the same thing. RETURN VALUE The remainder() function returns the remainder, unless y is zero, when the function fails and errno is set. ERRORS EDOM The denominator y is zero. CONFORMING TO IEC The three remainder*() functions are from C99. The function drem() is from BSD 4.3. The float and long double variants dremf() and dreml() exist on some systems, such as Tru64 and glibc2. EXAMPLE The call "remainder(29.0, 3.0)" returns 1. fmod(3)

33 RINT(3) Linux Programmer s Manual RINT(3) nearbyint, nearbyintf, nearbyintl, rint, rintf, rintl round to nearest integer double nearbyint(double x); float nearbyintf(float x); long double nearbyintl(long double x); double rint(double x); float rintf(float x); long double rintl(long double x); The nearbyint functions round their argument to an integer value in floating point format, using the current rounding direction and without raising the inexact exception. The rint functions do the same, but will raise the inexact exception when the result differs in value from the argument. RETURN VALUE The rounded integer value. If x is integral or infinite, x itself is returned. ERRORS No errors other than EDOM and ERANGE can occur. If x is NaN, then NaN is returned and errno may be set to EDOM. NOTES SUSv2 and POSIX contain text about overflow (which might set errno to ERANGE, or raise an exception). In practice, the result cannot overflow on any current machine, so this error-handling stuff is just nonsense. (More precisely, overflow can happen only when the maximum value of the exponent is smaller than the number of mantissa bits. For the IEEE-754 standard 32-bit and 64-bit floating point numbers the maximum value of the exponent is 128 (resp. 1024), and the number of mantissa bits is 24 (resp. 53).) CONFORMING TO The rint() function conforms to BSD 4.3. The other functions are from C99. ceil(3), floor(3), lrint(3), nearbyint(3), round(3), trunc(3)

34 SIN(3) Linux Programmer s Manual SIN(3) sin, sinf, sinl sine function double sin(double x); float sinf(float x); long double sinl(long double x); The sin() function returns the sine of x, where x is given in radians. RETURN VALUE The sin() function returns a value between 1 and 1. CONFORMING TO SVID 3, POSIX, BSD 4.3, ISO The float and the long double variants are C99 requirements. acos(3), asin(3), atan(3), atan2(3), cos(3), tan(3)

35 SINH(3) Linux Programmer s Manual SINH(3) sinh, sinhf, sinhl hyperbolic sine function double sinh(double x); float sinhf(float x); long double sinhl(long double x); The sinh() function returns the hyperbolic sine of x, which is defined mathematically as (exp(x) - exp(-x)) / 2. CONFORMING TO SVID 3, POSIX, BSD 4.3, ISO 9899 (C99). The float and the long double variants are C99 requirements. acosh(3), asinh(3), atanh(3), cosh(3), tanh(3)

36 SQRT(3) Linux Programmer s Manual SQRT(3) sqrt, sqrtf, sqrtl square root function double sqrt(double x); float sqrtf(float x); long double sqrtl(long double x); The sqrt() function returns the non-negative square root of x. It fails and sets errno to EDOM, if x is negative. ERRORS EDOM x is negative. CONFORMING TO SVID 3, POSIX, BSD 4.3, ISO The float and the long double variants are C99 requirements. hypot(3)

37 TAN(3) Linux Programmer s Manual TAN(3) tan, tanf, tanl tangent function double tan(double x); float tanf(float x); long double tanl(long double x); The tan() function returns the tangent of x, where x is given in radians. CONFORMING TO SVID 3, POSIX, BSD 4.3, ISO The float and the long double variants are C99 requirements. acos(3), asin(3), atan(3), atan2(3), cos(3), sin(3)

38 TANH(3) Linux Programmer s Manual TANH(3) tanh, tanhf, tanhl hyperbolic tangent function double tanh(double x); float tanhf(float x); long double tanhl(long double x); The tanh() function returns the hyperbolic tangent of x, which is defined mathematically as sinh(x) / cosh(x). CONFORMING TO SVID 3, POSIX, BSD 4.3, ISO 9899 (C99). The float and the long double variants are C99 requirements. acosh(3), asinh(3), atanh(3), cosh(3), sinh(3)

39 acos(p) acos(p) acos, acosf, acosl - arc cosine functions double acos(double x); float acosf(float x); long double acosl(long double x); The functionality described on this reference page is aligned with the ISO C standard. Any conflict between the requirements described here and the ISO C standard is unintentional. This volume of IEEE Std defers to the ISO C standard. These functions shall compute the principal value of the arc cosine of their argument x. The value of x should be in the range [-1,1]. An application wishing to check for error situations should set errno to zero and call feclearexcept(fe_all_except) before calling these functions. On return, if errno is non-zero or fetestexcept(fe_invalid FE_DIVBYZERO FE_OVERFLOW FE_UNDERFLOW) is non-zero, an error has occurred. RETURN VALUE Upon successful completion, these functions shall return the arc cosine of x, in the range [0,] radians. For finite values of x not in the range [-1,1], a domain error shall occur, and either a NaN (if supported), or an implementation-defined value shall be returned. If x is NaN, a NaN shall be returned. If x is +1, +0 shall be returned. If x is ±Inf, a domain error shall occur, and either a NaN (if supported), or an implementation-defined value shall be returned. ERRORS These functions shall fail if: Domain Error The x argument is finite and is not in the range [-1,1], <img src="../images/opt-start.gif" alt="[option Start]" border="0"> or is ±Inf. [EDOM]. If the integer expression (math_errhandling & MATH_ERREXCEPT) is non-zero, then the invalid floating-point exception shall be raised. The following sections are informative. EXAMPLES APPLICATION USAGE On error, the expressions (math_errhandling & MATH_ERRNO) and (math_errhandling & MATH_ERREXCEPT) are independent of each other, but at least one of them must be non-zero. RATIONALE FUTURE DIRECTIONS cos(), feclearexcept(), fetestexcept(), isnan(), the Base Definitions volume of IEEE Std , Section 4.18, Treatment of Error Conditions for Mathematical Functions, <math.h> POSIX

40 acos(p) acos(p) COPYRIGHT Portions of this text are reprinted and reproduced in electronic form from IEEE Std , 2003 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at POSIX

41 acosh(p) acosh(p) acosh, acoshf, acoshl - inverse hyperbolic cosine functions double acosh(double x); float acoshf(float x); long double acoshl(long double x); The functionality described on this reference page is aligned with the ISO C standard. Any conflict between the requirements described here and the ISO C standard is unintentional. This volume of IEEE Std defers to the ISO C standard. These functions shall compute the inverse hyperbolic cosine of their argument x. An application wishing to check for error situations should set errno to zero and call feclearexcept(fe_all_except) before calling these functions. On return, if errno is non-zero or fetestexcept(fe_invalid FE_DIVBYZERO FE_OVERFLOW FE_UNDERFLOW) is non-zero, an error has occurred. RETURN VALUE Upon successful completion, these functions shall return the inverse hyperbolic cosine of their argument. For finite values of x < 1, a domain error shall occur, and either a NaN (if supported), or an implementation-defined value shall be returned. If x is NaN, a NaN shall be returned. If x is +1, +0 shall be returned. If x is +Inf, +Inf shall be returned. If x is -Inf, a domain error shall occur, and either a NaN (if supported), or an implementation-defined value shall be returned. ERRORS These functions shall fail if: Domain Error The x argument is finite and less than +1.0, or is -Inf. [EDOM]. If the integer expression (math_errhandling & MATH_ERREXCEPT) is non-zero, then the invalid floating-point exception shall be raised. The following sections are informative. EXAMPLES APPLICATION USAGE On error, the expressions (math_errhandling & MATH_ERRNO) and (math_errhandling & MATH_ERREXCEPT) are independent of each other, but at least one of them must be non-zero. RATIONALE FUTURE DIRECTIONS cosh(), feclearexcept(), fetestexcept(), the Base Definitions volume of IEEE Std , Section 4.18, Treatment of Error Conditions for Mathematical Functions, <math.h> POSIX

42 acosh(p) acosh(p) COPYRIGHT Portions of this text are reprinted and reproduced in electronic form from IEEE Std , 2003 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at POSIX

43 asin(p) asin(p) asin, asinf, asinl - arc sine function double asin(double x); float asinf(float x); long double asinl(long double x); The functionality described on this reference page is aligned with the ISO C standard. Any conflict between the requirements described here and the ISO C standard is unintentional. This volume of IEEE Std defers to the ISO C standard. These functions shall compute the principal value of the arc sine of their argument x. The value of x should be in the range [-1,1]. An application wishing to check for error situations should set errno to zero and call feclearexcept(fe_all_except) before calling these functions. On return, if errno is non-zero or fetestexcept(fe_invalid FE_DIVBYZERO FE_OVERFLOW FE_UNDERFLOW) is non-zero, an error has occurred. RETURN VALUE Upon successful completion, these functions shall return the arc sine of x, in the range [-/2,/2] radians. For finite values of x not in the range [-1,1], a domain error shall occur, and either a NaN (if supported), or an implementation-defined value shall be returned. If x is NaN, a NaN shall be returned. If x is ±0, x shall be returned. If x is ±Inf, a domain error shall occur, and either a NaN (if supported), or an implementation-defined value shall be returned. If x is subnormal, a range error may occur and x should be returned. ERRORS These functions shall fail if: Domain Error The x argument is finite and is not in the range [-1,1], <img src="../images/opt-start.gif" alt="[option Start]" border="0"> or is ±Inf. [EDOM]. If the integer expression (math_errhandling & MATH_ERREXCEPT) is non-zero, then the invalid floating-point exception shall be raised. These functions may fail if: Range Error The value of x is subnormal. [ERANGE]. If the integer expression (math_errhandling & MATH_ERREXCEPT) is non-zero, then the underflow floating-point exception shall be raised. The following sections are informative. EXAMPLES APPLICATION USAGE On error, the expressions (math_errhandling & MATH_ERRNO) and (math_errhandling & MATH_ERREXCEPT) are independent of each other, but at least one of them must be non-zero. POSIX

44 asin(p) asin(p) RATIONALE FUTURE DIRECTIONS feclearexcept(), fetestexcept(), isnan(), sin(), the Base Definitions volume of IEEE Std , Section 4.18, Treatment of Error Conditions for Mathematical Functions, <math.h> COPYRIGHT Portions of this text are reprinted and reproduced in electronic form from IEEE Std , 2003 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at POSIX

45 asinh(p) asinh(p) asinh, asinhf, asinhl - inverse hyperbolic sine functions double asinh(double x); float asinhf(float x); long double asinhl(long double x); The functionality described on this reference page is aligned with the ISO C standard. Any conflict between the requirements described here and the ISO C standard is unintentional. This volume of IEEE Std defers to the ISO C standard. These functions shall compute the inverse hyperbolic sine of their argument x. An application wishing to check for error situations should set errno to zero and call feclearexcept(fe_all_except) before calling these functions. On return, if errno is non-zero or fetestexcept(fe_invalid FE_DIVBYZERO FE_OVERFLOW FE_UNDERFLOW) is non-zero, an error has occurred. RETURN VALUE Upon successful completion, these functions shall return the inverse hyperbolic sine of their argument. If x is NaN, a NaN shall be returned. If x is ±0, or ±Inf, x shall be returned. If x is subnormal, a range error may occur and x should be returned. ERRORS These functions may fail if: Range Error The value of x is subnormal. [ERANGE]. If the integer expression (math_errhandling & MATH_ERREXCEPT) is non-zero, then the underflow floating-point exception shall be raised. The following sections are informative. EXAMPLES APPLICATION USAGE On error, the expressions (math_errhandling & MATH_ERRNO) and (math_errhandling & MATH_ERREXCEPT) are independent of each other, but at least one of them must be non-zero. RATIONALE FUTURE DIRECTIONS feclearexcept(), fetestexcept(), sinh(), the Base Definitions volume of IEEE Std , Section 4.18, Treatment of Error Conditions for Mathematical Functions, <math.h> COPYRIGHT Portions of this text are reprinted and reproduced in electronic form from IEEE Std , 2003 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the POSIX

46 asinh(p) asinh(p) referee document. The original Standard can be obtained online at POSIX

47 atan(p) atan(p) atan, atanf, atanl - arc tangent function double atan(double x); float atanf(float x); long double atanl(long double x); The functionality described on this reference page is aligned with the ISO C standard. Any conflict between the requirements described here and the ISO C standard is unintentional. This volume of IEEE Std defers to the ISO C standard. These functions shall compute the principal value of the arc tangent of their argument x. An application wishing to check for error situations should set errno to zero and call feclearexcept(fe_all_except) before calling these functions. On return, if errno is non-zero or fetestexcept(fe_invalid FE_DIVBYZERO FE_OVERFLOW FE_UNDERFLOW) is non-zero, an error has occurred. RETURN VALUE Upon successful completion, these functions shall return the arc tangent of x in the range [-/2,/2] radians. If x is NaN, a NaN shall be returned. If x is ±0, x shall be returned. If x is ±Inf, ±/2 shall be returned. If x is subnormal, a range error may occur and x should be returned. ERRORS These functions may fail if: Range Error The value of x is subnormal. [ERANGE]. If the integer expression (math_errhandling & MATH_ERREXCEPT) is non-zero, then the underflow floating-point exception shall be raised. The following sections are informative. EXAMPLES APPLICATION USAGE On error, the expressions (math_errhandling & MATH_ERRNO) and (math_errhandling & MATH_ERREXCEPT) are independent of each other, but at least one of them must be non-zero. RATIONALE FUTURE DIRECTIONS atan2(), feclearexcept(), fetestexcept(), isnan(), tan(), the Base Definitions volume of IEEE Std , Section 4.18, Treatment of Error Conditions for Mathematical Functions, <math.h> COPYRIGHT Portions of this text are reprinted and reproduced in electronic form from IEEE Std , 2003 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open POSIX

48 atan(p) atan(p) Group Base Specifications Issue 6, Copyright (C) by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at POSIX

49 atan2(p) atan2(p) atan2, atan2f, atan2l - arc tangent functions double atan2(double y, double x); float atan2f(float y, float x); long double atan2l(long double y, long double x); The functionality described on this reference page is aligned with the ISO C standard. Any conflict between the requirements described here and the ISO C standard is unintentional. This volume of IEEE Std defers to the ISO C standard. These functions shall compute the principal value of the arc tangent of y/ x, using the signs of both arguments to determine the quadrant of the return value. An application wishing to check for error situations should set errno to zero and call feclearexcept(fe_all_except) before calling these functions. On return, if errno is non-zero or fetestexcept(fe_invalid FE_DIVBYZERO FE_OVERFLOW FE_UNDERFLOW) is non-zero, an error has occurred. RETURN VALUE Upon successful completion, these functions shall return the arc tangent of y/ x in the range [-,] radians. If y is ±0 and x is < 0, ± shall be returned. If y is ±0 and x is > 0, ±0 shall be returned. If y is < 0 and x is ±0, -/2 shall be returned. If y is > 0 and x is ±0, /2 shall be returned. If x is 0, a pole error shall not occur. If either x or y is NaN, a NaN shall be returned. If the result underflows, a range error may occur and y/ x should be returned. If y is ±0 and x is -0, ± shall be returned. If y is ±0 and x is +0, ±0 shall be returned. For finite values of ± y >0,ifxis -Inf, ± shall be returned. For finite values of ± y >0,ifxis +Inf, ±0 shall be returned. For finite values of x, ifyis ±Inf, ±/2 shall be returned. If y is ±Inf and x is -Inf, ±3/4 shall be returned. If y is ±Inf and x is +Inf, ±/4 shall be returned. If both arguments are 0, a domain error shall not occur. ERRORS These functions may fail if: Range Error The result underflows. [ERANGE]. If the integer expression (math_errhandling & MATH_ERREXCEPT) is non-zero, then the underflow floating-point exception shall be raised. The following sections are informative. POSIX

50 atan2(p) atan2(p) EXAMPLES APPLICATION USAGE On error, the expressions (math_errhandling & MATH_ERRNO) and (math_errhandling & MATH_ERREXCEPT) are independent of each other, but at least one of them must be non-zero. RATIONALE FUTURE DIRECTIONS atan(), feclearexcept(), fetestexcept(), isnan(), tan(), the Base Definitions volume of IEEE Std , Section 4.18, Treatment of Error Conditions for Mathematical Functions, <math.h> COPYRIGHT Portions of this text are reprinted and reproduced in electronic form from IEEE Std , 2003 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at POSIX

51 atanh(p) atanh(p) atanh, atanhf, atanhl - inverse hyperbolic tangent functions double atanh(double x); float atanhf(float x); long double atanhl(long double x); The functionality described on this reference page is aligned with the ISO C standard. Any conflict between the requirements described here and the ISO C standard is unintentional. This volume of IEEE Std defers to the ISO C standard. These functions shall compute the inverse hyperbolic tangent of their argument x. An application wishing to check for error situations should set errno to zero and call feclearexcept(fe_all_except) before calling these functions. On return, if errno is non-zero or fetestexcept(fe_invalid FE_DIVBYZERO FE_OVERFLOW FE_UNDERFLOW) is non-zero, an error has occurred. RETURN VALUE Upon successful completion, these functions shall return the inverse hyperbolic tangent of their argument. If x is ±1, a pole error shall occur, and atanh(), atanhf(), and atanhl() shall return the value of the macro HUGE_VAL, HUGE_VALF, and HUGE_VALL, respectively, with the same sign as the correct value of the function. For finite x >1, a domain error shall occur, and either a NaN (if supported), or an implementationdefined value shall be returned. If x is NaN, a NaN shall be returned. If x is ±0, x shall be returned. If x is ±Inf, a domain error shall occur, and either a NaN (if supported), or an implementation-defined value shall be returned. If x is subnormal, a range error may occur and x should be returned. ERRORS These functions shall fail if: Domain Error The x argument is finite and not in the range [-1,1], or is ±Inf. [EDOM]. If the integer expression (math_errhandling & MATH_ERREXCEPT) is non-zero, then the invalid floating-point exception shall be raised. Pole Error The x argument is ±1. [ERANGE]. If the integer expression (math_errhandling & MATH_ERREXCEPT) is non-zero, then the divide-by-zero floating-point exception shall be raised. These functions may fail if: Range Error The value of x is subnormal. [ERANGE]. If the integer expression (math_errhandling & MATH_ERREXCEPT) is non-zero, then POSIX

52 atanh(p) atanh(p) the underflow floating-point exception shall be raised. The following sections are informative. EXAMPLES APPLICATION USAGE On error, the expressions (math_errhandling & MATH_ERRNO) and (math_errhandling & MATH_ERREXCEPT) are independent of each other, but at least one of them must be non-zero. RATIONALE FUTURE DIRECTIONS feclearexcept(), fetestexcept(), tanh(), the Base Definitions volume of IEEE Std , Section 4.18, Treatment of Error Conditions for Mathematical Functions, <math.h> COPYRIGHT Portions of this text are reprinted and reproduced in electronic form from IEEE Std , 2003 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at POSIX

53 cbrt(p) cbrt(p) cbrt, cbrtf, cbrtl - cube root functions double cbrt(double x); float cbrtf(float x); long double cbrtl(long double x); The functionality described on this reference page is aligned with the ISO C standard. Any conflict between the requirements described here and the ISO C standard is unintentional. This volume of IEEE Std defers to the ISO C standard. These functions shall compute the real cube root of their argument x. RETURN VALUE Upon successful completion, these functions shall return the cube root of x. If x is NaN, a NaN shall be returned. If x is ±0 or±inf, x shall be returned. ERRORS No errors are defined. The following sections are informative. EXAMPLES APPLICATION USAGE RATIONALE For some applications, a true cube root function, which returns negative results for negative arguments, is more appropriate than pow( x, 1.0/3.0), which returns a NaN for x less than 0. FUTURE DIRECTIONS The Base Definitions volume of IEEE Std , <math.h> COPYRIGHT Portions of this text are reprinted and reproduced in electronic form from IEEE Std , 2003 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at POSIX

54 ceil(p) ceil(p) ceil, ceilf, ceill - ceiling value function double ceil(double x); float ceilf(float x); long double ceill(long double x); The functionality described on this reference page is aligned with the ISO C standard. Any conflict between the requirements described here and the ISO C standard is unintentional. This volume of IEEE Std defers to the ISO C standard. These functions shall compute the smallest integral value not less than x. An application wishing to check for error situations should set errno to zero and call feclearexcept(fe_all_except) before calling these functions. On return, if errno is non-zero or fetestexcept(fe_invalid FE_DIVBYZERO FE_OVERFLOW FE_UNDERFLOW) is non-zero, an error has occurred. RETURN VALUE Upon successful completion, ceil(), ceilf(), and ceill() shall return the smallest integral value not less than x, expressed as a type double, float, orlong double, respectively. If x is NaN, a NaN shall be returned. If x is ±0 or±inf, x shall be returned. If the correct value would cause overflow, a range error shall occur and ceil(), ceilf(), and ceill() shall return the value of the macro HUGE_VAL, HUGE_VALF, and HUGE_VALL, respectively. ERRORS These functions shall fail if: Range Error The result overflows. [ERANGE]. If the integer expression (math_errhandling & MATH_ERREXCEPT) is non-zero, then the overflow floating-point exception shall be raised. The following sections are informative. EXAMPLES APPLICATION USAGE The integral value returned by these functions need not be expressible as an int or long. The return value should be tested before assigning it to an integer type to avoid the undefined results of an integer overflow. The ceil() function can only overflow when the floating-point representation has DBL_MANT_DIG > DBL_MAX_EXP. On error, the expressions (math_errhandling & MATH_ERRNO) and (math_errhandling & MATH_ERREXCEPT) are independent of each other, but at least one of them must be non-zero. RATIONALE FUTURE DIRECTIONS POSIX

The Red Hat newlib C Math Library

The Red Hat newlib C Math Library The Red Hat newlib C Math Library libm 1.17.0 December 2008 Steve Chamberlain Roland Pesch Red Hat Support Jeff Johnston Red Hat Support sac@cygnus.com pesch@cygnus.com jjohnstn@redhat.com Copyright c

More information

The Cygnus C Math Library

The Cygnus C Math Library The Cygnus C Math Library libm 1.4 December 1995 Steve Chamberlain Roland Pesch Cygnus Support Cygnus Support sac@cygnus.com pesch@cygnus.com Copyright c 1992, 1993 Cygnus Support libm includes software

More information

The Red Hat newlib C Math Library

The Red Hat newlib C Math Library The Red Hat newlib C Math Library libm 1.11.0 July 2002 Steve Chamberlain Roland Pesch Red Hat Support Jeff Johnston Red Hat Support sac@cygnus.com pesch@cygnus.com jjohnstn@redhat.com Copyright c 1992,

More information

The Red Hat newlib C Math Library

The Red Hat newlib C Math Library The Red Hat newlib C Math Library libm 2.1.0 December 2013 Steve Chamberlain Roland Pesch Red Hat Support Jeff Johnston Red Hat Support sac@cygnus.com pesch@cygnus.com jjohnstn@redhat.com Copyright c 1992,

More information

9 C Language Function Block

9 C Language Function Block 9 C Language Function Block In this chapter, we focus on C language function block s specifications, edition, instruction calling, application points etc. we also attach the common Function list. 9-1.Functions

More information

ECET 264 C Programming Language with Applications

ECET 264 C Programming Language with Applications ECET 264 C Programming Language with Applications Lecture 10 C Standard Library Functions Paul I. Lin Professor of Electrical & Computer Engineering Technology http://www.etcs.ipfw.edu/~lin Lecture 10

More information

CUDA MATH API. v6.5 August API Reference Manual

CUDA MATH API. v6.5 August API Reference Manual CUDA MATH API v65 August 2014 API Reference Manual TABLE OF CONTENTS Chapter 1 1 11 Mathematical Functions 1 12 Single Precision Mathematical Functions 1 acosf 2 acoshf 2 asinf 2 asinhf3 atan2f 3 atanf

More information

Highly Optimized Mathematical Functions for the Itanium Processor

Highly Optimized Mathematical Functions for the Itanium Processor Highly Optimized Mathematical Functions for the Itanium Processor! Speaker: Shane Story! Software Engineer! CSL Numerics Group! Corporation Copyright Copyright 2001 2001 Corporation. Agenda! Itanium Processor

More information

Built-in Types of Data

Built-in Types of Data Built-in Types of Data Types A data type is set of values and a set of operations defined on those values Python supports several built-in data types: int (for integers), float (for floating-point numbers),

More information

SIMD Math Library API Reference

SIMD Math Library API Reference Software Development Kit for Multicore Acceleration Version 3.0 SIMD Math Library API Reference SC33-8335-01 Software Development Kit for Multicore Acceleration Version 3.0 SIMD Math Library API Reference

More information

CUDA MATH API. v8.0 February API Reference Manual

CUDA MATH API. v8.0 February API Reference Manual CUDA MATH API v80 February 2016 API Reference Manual TABLE OF CONTENTS Chapter 1 1 11 Mathematical Functions 1 12 Single Precision Mathematical Functions 2 acosf 2 acoshf 2 asinf 3 asinhf3 atan2f 3 atanf

More information

constexpr for <cmath> and <cstdlib>

constexpr for <cmath> and <cstdlib> constexpr for and Document: P0533R0 Date: January 25, 2017 Project: Programming Language C++, Library Working Group Audience: SG6, LEWG Reply to: Edward J. Rosten / Oliver J. Rosten

More information

constexpr for <cmath> and <cstdlib>

constexpr for <cmath> and <cstdlib> constexpr for and Document: P0533R2 Date: February 10, 2018 Project: Programming Language C++, Library Working Group Audience: SG6, LEWG Reply to: Edward J. Rosten / Oliver J. Rosten

More information

INTRODUCTION TO C++ FUNCTIONS. Dept. of Electronic Engineering, NCHU. Original slides are from

INTRODUCTION TO C++ FUNCTIONS. Dept. of Electronic Engineering, NCHU. Original slides are from INTRODUCTION TO C++ FUNCTIONS Original slides are from http://sites.google.com/site/progntut/ Dept. of Electronic Engineering, NCHU Outline 2 Functions: Program modules in C Function Definitions Function

More information

Expressions and operators

Expressions and operators Mathematical operators and expressions The five basic binary mathematical operators are Operator Operation Example + Addition a = b + c - Subtraction a = b c * Multiplication a = b * c / Division a = b

More information

Functions. Functions are everywhere in C. Pallab Dasgupta Professor, Dept. of Computer Sc & Engg INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR

Functions. Functions are everywhere in C. Pallab Dasgupta Professor, Dept. of Computer Sc & Engg INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR 1 Functions Functions are everywhere in C Pallab Dasgupta Professor, Dept. of Computer Sc & Engg INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR Introduction Function A self-contained program segment that carries

More information

Programming for Engineers in Python. Recitation 2

Programming for Engineers in Python. Recitation 2 Programming for Engineers in Python Recitation 2 Plan Range For loop While loop Lists Modules Operations Arithmetic Operations: + plus - minus * multiply / divide (int / float) % modulo (remainder) **

More information

Arithmetic and Logic Blocks

Arithmetic and Logic Blocks Arithmetic and Logic Blocks The Addition Block The block performs addition and subtractions on its inputs. This block can add or subtract scalar, vector, or matrix inputs. We can specify the operation

More information

tag 220 tan[f l] struct { int i; double d; } sa, sb; struct { int i; double d; } s1, s2;

tag 220 tan[f l] struct { int i; double d; } sa, sb; struct { int i; double d; } s1, s2; tag 220 T tag The identifier that may optionally follow the keyword struct, union, or enum in a structure, union, or enumerated type definition, respectively. The tag is used later to refer to that particular

More information

Script started on Thu 25 Aug :00:40 PM CDT

Script started on Thu 25 Aug :00:40 PM CDT Script started on Thu 25 Aug 2016 02:00:40 PM CDT < M A T L A B (R) > Copyright 1984-2014 The MathWorks, Inc. R2014a (8.3.0.532) 64-bit (glnxa64) February 11, 2014 To get started, type one of these: helpwin,

More information

Chap 6 Function Define a function, which can reuse a piece of code, just with a few different values.

Chap 6 Function Define a function, which can reuse a piece of code, just with a few different values. Chap 6 Function Define a function, which can reuse a piece of code, just with a few different values. def tax(bill): """Adds 8% tax to a restaurant bill.""" bill *= 1.08 print "With tax: %f" % bill return

More information

Functions. Prof. Indranil Sen Gupta. Dept. of Computer Science & Engg. Indian Institute t of Technology Kharagpur. Introduction

Functions. Prof. Indranil Sen Gupta. Dept. of Computer Science & Engg. Indian Institute t of Technology Kharagpur. Introduction Functions Prof. Indranil Sen Gupta Dept. of Computer Science & Engg. Indian Institute t of Technology Kharagpur Programming and Data Structure 1 Function Introduction A self-contained program segment that

More information

C Programs: Simple Statements and Expressions

C Programs: Simple Statements and Expressions .. Cal Poly CPE 101: Fundamentals of Computer Science I Alexander Dekhtyar.. C Programs: Simple Statements and Expressions C Program Structure A C program that consists of only one function has the following

More information

constexpr for <cmath> and <cstdlib>

constexpr for <cmath> and <cstdlib> constexpr for and Document: P0533R4 Date: January 7, 2019 Project: Programming Language C++, Library Working Group Audience: LWG Reply to: Edward J. Rosten (erosten@snap.com) / Oliver

More information

SIMD Math Library Specification for

SIMD Math Library Specification for SIMD Math Library Specification for Cell Broadband Engine Architecture Version 1.0 CBEA JSRE Series Cell Broadband Engine Architecture Joint Software Reference Environment Series November 27, 2006 Copyright

More information

Single row numeric functions

Single row numeric functions Single row numeric functions Oracle provides a lot of standard numeric functions for single rows. Here is a list of all the single row numeric functions (in version 10.2). Function Description ABS(n) ABS

More information

Using the um-fpu with the Javelin Stamp

Using the um-fpu with the Javelin Stamp Using the um-fpu with the Javelin Stamp Introduction The um-fpu is a 32-bit floating point coprocessor that can be easily interfaced with the Javelin Stamp to provide support for 32-bit IEEE 754 floating

More information

Lecture 14. Daily Puzzle. Math in C. Rearrange the letters of eleven plus two to make this mathematical statement true. Eleven plus two =?

Lecture 14. Daily Puzzle. Math in C. Rearrange the letters of eleven plus two to make this mathematical statement true. Eleven plus two =? Lecture 14 Math in C Daily Puzzle Rearrange the letters of eleven plus two to make this mathematical statement true. Eleven plus two =? Daily Puzzle SOLUTION Eleven plus two = twelve plus one Announcements

More information

Programming for Engineers in Python. Recitation 3 Functions

Programming for Engineers in Python. Recitation 3 Functions Programming for Engineers in Python Recitation 3 Functions Plan Short review FOR and Lists Python references Mutable vs. immutable data types List references Functions Scope Call by assignment Global variables

More information

Python. Olmo Zavala R. Python Exercises. Center of Atmospheric Sciences, UNAM. August 24, 2016

Python. Olmo Zavala R. Python Exercises. Center of Atmospheric Sciences, UNAM. August 24, 2016 Exercises Center of Atmospheric Sciences, UNAM August 24, 2016 NAND Make function that computes the NAND. It should receive two booleans and return one more boolean. logical operators A and B, A or B,

More information

6-1 (Function). (Function) !*+!"#!, Function Description Example. natural logarithm of x (base e) rounds x to smallest integer not less than x

6-1 (Function). (Function) !*+!#!, Function Description Example. natural logarithm of x (base e) rounds x to smallest integer not less than x (Function) -1.1 Math Library Function!"#! $%&!'(#) preprocessor directive #include !*+!"#!, Function Description Example sqrt(x) square root of x sqrt(900.0) is 30.0 sqrt(9.0) is 3.0 exp(x) log(x)

More information

DUBLIN CITY UNIVERSITY

DUBLIN CITY UNIVERSITY DUBLIN CITY UNIVERSITY SEMESTER ONE EXAMINATIONS 2007 MODULE: Object Oriented Programming I - EE219 COURSE: B.Eng. in Electronic Engineering B.Eng. in Information Telecommunications Engineering B.Eng.

More information

ADSP-2100 Family. C Runtime Library Manual

ADSP-2100 Family. C Runtime Library Manual ADSP-2100 Family C Runtime Library Manual a ADSP-2100 Family C Runtime Library Manual 1994 Analog Devices, Inc. ALL RIGHTS RESERVED PRODUCT AND DOCUMENTATION NOTICE: Analog Devices reserves the right to

More information

(IUCAA, Pune) kaustubh[at]iucaa[dot]ernet[dot]in.

(IUCAA, Pune)   kaustubh[at]iucaa[dot]ernet[dot]in. Basics of Python by Kaustubh Vaghmare (IUCAA, Pune) E-mail: kaustubh[at]iucaa[dot]ernet[dot]in 1 of 29 Thursday 13 February 2014 11:59 AM Topics to be Covered (Not in any specific order.) Basic I/O in

More information

Introduction to Scientific and Engineering Computing, BIL108E. Karaman

Introduction to Scientific and Engineering Computing, BIL108E. Karaman USING MATLAB INTRODUCTION TO SCIENTIFIC & ENGINEERING COMPUTING BIL 108E, CRN24023 To start from Windows, Double click the Matlab icon. To start from UNIX, Dr. S. Gökhan type matlab at the shell prompt.

More information

INSIDE MACINTOSH. Addison-Wesley Publishing Company

INSIDE MACINTOSH. Addison-Wesley Publishing Company apple INSIDE MACINTOSH PowerPC Numerics Addison-Wesley Publishing Company Reading, Massachusetts Menlo Park, California New York Don Mills, Ontario Wokingham, England Amsterdam Bonn Sydney Singapore Tokyo

More information

DUBLIN CITY UNIVERSITY

DUBLIN CITY UNIVERSITY DUBLIN CITY UNIVERSITY REPEAT EXAMINATIONS 2008 MODULE: Object-oriented Programming I - EE219 COURSE: B.Eng. in Electronic Engineering (Year 2 & 3) B.Eng. in Information Telecomms Engineering (Year 2 &

More information

DM550/DM857 Introduction to Programming. Peter Schneider-Kamp

DM550/DM857 Introduction to Programming. Peter Schneider-Kamp DM550/DM857 Introduction to Programming Peter Schneider-Kamp petersk@imada.sdu.dk http://imada.sdu.dk/~petersk/dm550/ http://imada.sdu.dk/~petersk/dm857/ Operator Precedence expressions are evaluated left-to-right

More information

Using Free Functions

Using Free Functions Chapter 3 Using Free Functions 3rd Edition Computing Fundamentals with C++ Rick Mercer Franklin, Beedle & Associates Goals Evaluate some mathematical and trigonometric functions Use arguments in function

More information

Lab 7: Reading Files, Importing, Bigram Function. Ling 1330/2330: Computational Linguistics Na-Rae Han

Lab 7: Reading Files, Importing, Bigram Function. Ling 1330/2330: Computational Linguistics Na-Rae Han Lab 7: Reading Files, Importing, Bigram Function Ling 1330/2330: Computational Linguistics Na-Rae Han Objectives Importing Reading text files range() Bigram function More sorting with sorted() sorted()

More information

An Elementary Transcendental Function Core Library for Reconfigurable Computing. Robin Bruce, Dr Malachy Devlin, Prof Stephen Marshall

An Elementary Transcendental Function Core Library for Reconfigurable Computing. Robin Bruce, Dr Malachy Devlin, Prof Stephen Marshall An Elementary Transcendental Function Core Library for Reconfigurable Computing Robin Bruce, Dr Malachy Devlin, Prof Stephen Marshall Introduction Project: Implement Floating-Point Math Functions on FPGAs

More information

Function Example. Function Definition. C Programming. Syntax. A small program(subroutine) that performs a particular task. Modular programming design

Function Example. Function Definition. C Programming. Syntax. A small program(subroutine) that performs a particular task. Modular programming design What is a Function? C Programming Lecture 8-1 : Function (Basic) A small program(subroutine) that performs a particular task Input : parameter / argument Perform what? : function body Output t : return

More information

12. Numbers. Java. Summer 2008 Instructor: Dr. Masoud Yaghini

12. Numbers. Java. Summer 2008 Instructor: Dr. Masoud Yaghini 12. Numbers Java Summer 2008 Instructor: Dr. Masoud Yaghini Outline Numeric Type Conversions Math Class References Numeric Type Conversions Numeric Data Types (Review) Numeric Type Conversions Consider

More information

Lesson #3. Variables, Operators, and Expressions. 3. Variables, Operators and Expressions - Copyright Denis Hamelin - Ryerson University

Lesson #3. Variables, Operators, and Expressions. 3. Variables, Operators and Expressions - Copyright Denis Hamelin - Ryerson University Lesson #3 Variables, Operators, and Expressions Variables We already know the three main types of variables in C: int, char, and double. There is also the float type which is similar to double with only

More information

LAB 1 General MATLAB Information 1

LAB 1 General MATLAB Information 1 LAB 1 General MATLAB Information 1 General: To enter a matrix: > type the entries between square brackets, [...] > enter it by rows with elements separated by a space or comma > rows are terminated by

More information

Basic types and definitions. Chapter 3 of Thompson

Basic types and definitions. Chapter 3 of Thompson Basic types and definitions Chapter 3 of Thompson Booleans [named after logician George Boole] Boolean values True and False are the result of tests are two numbers equal is one smaller than the other

More information

Computing Fundamentals

Computing Fundamentals Computing Fundamentals Salvatore Filippone salvatore.filippone@uniroma2.it 2012 2013 (salvatore.filippone@uniroma2.it) Computing Fundamentals 2012 2013 1 / 18 Octave basics Octave/Matlab: f p r i n t f

More information

Function. specific, well-defined task. whenever it is called or invoked. A function to add two numbers A function to find the largest of n numbers

Function. specific, well-defined task. whenever it is called or invoked. A function to add two numbers A function to find the largest of n numbers Functions 1 Function n A program segment that carries out some specific, well-defined task n Example A function to add two numbers A function to find the largest of n numbers n A function will carry out

More information

Introduction to GNU-Octave

Introduction to GNU-Octave Introduction to GNU-Octave Dr. K.R. Chowdhary, Professor & Campus Director, JIETCOE JIET College of Engineering Email: kr.chowdhary@jietjodhpur.ac.in Web-Page: http://www.krchowdhary.com July 11, 2016

More information

Mentor Graphics Predefined Packages

Mentor Graphics Predefined Packages Mentor Graphics Predefined Packages Mentor Graphics has created packages that define various types and subprograms that make it possible to write and simulate a VHDL model within the Mentor Graphics environment.

More information

Programming for Engineers in Python. Recitation 3

Programming for Engineers in Python. Recitation 3 Programming for Engineers in Python Recitation 3 Plan Modules / Packages Tuples Mutable / Imutable Dictionaries Functions: Scope Call by Ref / Call by Val Frequency Counter Python Code Hierarchy Statement

More information

C++, How to Program. Spring 2016 CISC1600 Yanjun Li 1

C++, How to Program. Spring 2016 CISC1600 Yanjun Li 1 Chapter 6 Function C++, How to Program Deitel & Deitel Spring 2016 CISC1600 Yanjun Li 1 Function A function is a collection of statements that performs a specific task - a single, well-defined task. Divide

More information

(IUCAA, Pune) kaustubh[at]iucaa[dot]ernet[dot]in 1 of 29 Thursday 16 October :50 PM

(IUCAA, Pune)   kaustubh[at]iucaa[dot]ernet[dot]in 1 of 29 Thursday 16 October :50 PM Basics of Python by Kaustubh Vaghmare (IUCAA, Pune) E-mail: kaustubh[at]iucaa[dot]ernet[dot]in 1 of 29 Thursday 16 October 2014 03:50 PM Topics to be Covered (Not in any specific order.) Basic I/O in Python

More information

Dr Richard Greenaway

Dr Richard Greenaway SCHOOL OF PHYSICS, ASTRONOMY & MATHEMATICS 4PAM1008 MATLAB 2 Basic MATLAB Operation Dr Richard Greenaway 2 Basic MATLAB Operation 2.1 Overview 2.1.1 The Command Line In this Workshop you will learn how

More information

Preview from Notesale.co.uk Page 2 of 79

Preview from Notesale.co.uk Page 2 of 79 COMPUTER PROGRAMMING TUTORIAL by tutorialspoint.com Page 2 of 79 tutorialspoint.com i CHAPTER 3 Programming - Environment Though Environment Setup is not an element of any Programming Language, it is the

More information

1001ICT Introduction To Programming Lecture Notes

1001ICT Introduction To Programming Lecture Notes 1001ICT Introduction To Programming Lecture Notes School of Information and Communication Technology Griffith University Semester 1, 2015 1 M Environment console M.1 Purpose This environment supports programming

More information

Function I/O. Function Input and Output. Input through actual parameters. Output through return value. Input/Output through side effects

Function I/O. Function Input and Output. Input through actual parameters. Output through return value. Input/Output through side effects Function Input and Output Input through actual parameters Output through return value Only one value can be returned Input/Output through side effects printf scanf 2 tj Function Input and Output int main(void){

More information

How to Design Programs Languages

How to Design Programs Languages How to Design Programs Languages Version 4.1 August 12, 2008 The languages documented in this manual are provided by DrScheme to be used with the How to Design Programs book. 1 Contents 1 Beginning Student

More information

Functions. Autumn Semester 2009 Programming and Data Structure 1. Courtsey: University of Pittsburgh-CSD-Khalifa

Functions. Autumn Semester 2009 Programming and Data Structure 1. Courtsey: University of Pittsburgh-CSD-Khalifa Functions Autumn Semester 2009 Programming and Data Structure 1 Courtsey: University of Pittsburgh-CSD-Khalifa Introduction Function A self-contained program segment that carries out some specific, well-defined

More information

SPIR-V Extended Instructions for GLSL

SPIR-V Extended Instructions for GLSL SPIR-V Etended Instructions for GLSL John Kessenich, Google Version 1.00, Revision 7 August 8, 2018 SPIR-V Etended Instructions for GLSL Copyright 2014-2018 The Khronos Group Inc. All Rights Reserved.

More information

Lecture 2:- Functions. Introduction

Lecture 2:- Functions. Introduction Lecture 2:- Functions Introduction A function groups a number of program statements into a unit and gives it a name. This unit can then be invoked from other parts of the program. The most important reason

More information

Function I/O. Last Updated 10/30/18

Function I/O. Last Updated 10/30/18 Last Updated 10/30/18 Program Structure Includes Function Declarations void main(void){ foo = fun1(a, b); fun2(2, c); if(fun1(c, d)) { } } Function 1 Definition Function 2 Definition 2 tj Function Input

More information

Functions. Systems Programming Concepts

Functions. Systems Programming Concepts Functions Systems Programming Concepts Functions Simple Function Example Function Prototype and Declaration Math Library Functions Function Definition Header Files Random Number Generator Call by Value

More information

Chapter 5 Methods. Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved.

Chapter 5 Methods. Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved. Chapter 5 Methods rights reserved. 0132130807 1 Opening Problem Find the sum of integers from 1 to 10, from 20 to 30, and from 35 to 45, respectively. rights reserved. 0132130807 2 1 Problem int sum =

More information

C Functions. 5.2 Program Modules in C

C Functions. 5.2 Program Modules in C 1 5 C Functions 5.2 Program Modules in C 2 Functions Modules in C Programs combine user-defined functions with library functions - C standard library has a wide variety of functions Function calls Invoking

More information

Introduction to Programming

Introduction to Programming Introduction to Programming session 9 Instructor: Reza Entezari-Maleki Email: entezari@ce.sharif.edu 1 Fall 2010 These slides are created using Deitel s slides Sahrif University of Technology Outlines

More information

GRAPH 4.4. Megha K. Raman APRIL 22, 2015

GRAPH 4.4. Megha K. Raman APRIL 22, 2015 GRAPH 4.4 By Megha K. Raman APRIL 22, 2015 1. Preface... 4 2. Introduction:... 4 3. Plotting a function... 5 Sample funtions:... 9 List of Functions:... 10 Constants:... 10 Operators:... 11 Functions:...

More information

Matlab Workshop I. Niloufer Mackey and Lixin Shen

Matlab Workshop I. Niloufer Mackey and Lixin Shen Matlab Workshop I Niloufer Mackey and Lixin Shen Western Michigan University/ Syracuse University Email: nil.mackey@wmich.edu, lshen03@syr.edu@wmich.edu p.1/13 What is Matlab? Matlab is a commercial Matrix

More information

Julia Calculator ( Introduction)

Julia Calculator ( Introduction) Julia Calculator ( Introduction) Julia can replicate the basics of a calculator with the standard notations. Binary operators Symbol Example Addition + 2+2 = 4 Substraction 2*3 = 6 Multify * 3*3 = 9 Division

More information

MATLAB Constants, Variables & Expression. 9/12/2015 By: Nafees Ahmed

MATLAB Constants, Variables & Expression. 9/12/2015 By: Nafees Ahmed MATLAB Constants, Variables & Expression Introduction MATLAB can be used as a powerful programming language. It do have IF, WHILE, FOR lops similar to other programming languages. It has its own vocabulary

More information

Fixed point algorithmic math package user s guide By David Bishop

Fixed point algorithmic math package user s guide By David Bishop Fixed point algorithmic math package user s guide By David Bishop (dbishop@vhdl.org) The fixed point matrix math package was designed to be a synthesizable matrix math package. Because this package allows

More information

Information technology Programming languages, their environments, and system software interfaces Floating- point extensions for C

Information technology Programming languages, their environments, and system software interfaces Floating- point extensions for C ISO/IEC JTC 1/SC 22/WG 14 N1950 TECHNICAL SPECIFICATON ISO/IEC TS 18661-4 First edition 2015-06- 10 Information technology Programming languages, their environments, and system software interfaces Floating-

More information

Macro Programming Reference Guide. Copyright 2005 Scott Martinez

Macro Programming Reference Guide. Copyright 2005 Scott Martinez Macro Programming Reference Guide Copyright 2005 Scott Martinez Section 1. Section 2. Section 3. Section 4. Section 5. Section 6. Section 7. What is macro programming What are Variables What are Expressions

More information

BIL 104E Introduction to Scientific and Engineering Computing. Lecture 4

BIL 104E Introduction to Scientific and Engineering Computing. Lecture 4 BIL 104E Introduction to Scientific and Engineering Computing Lecture 4 Introduction Divide and Conquer Construct a program from smaller pieces or components These smaller pieces are called modules Functions

More information

ISO/IEC 2013 All rights reserved Working Group Draft December 19, Committee identification: ISO/IEC JTC 1/SC 22/WG 14

ISO/IEC 2013 All rights reserved Working Group Draft December 19, Committee identification: ISO/IEC JTC 1/SC 22/WG 14 ISO/IEC 13 All rights reserved Working Group Draft December 19, 13 ISO/IEC JTC 1/SC 22/WG 14 N178 Date: yyyy-mm-dd Reference number of document: ISO/IEC TS 18661-4 Committee identification: ISO/IEC JTC

More information

General MATLAB Information 1

General MATLAB Information 1 Introduction to MATLAB General MATLAB Information 1 Once you initiate the MATLAB software, you will see the MATLAB logo appear and then the MATLAB prompt >>. The prompt >> indicates that MATLAB is awaiting

More information

MYSQL NUMERIC FUNCTIONS

MYSQL NUMERIC FUNCTIONS MYSQL NUMERIC FUNCTIONS http://www.tutorialspoint.com/mysql/mysql-numeric-functions.htm Copyright tutorialspoint.com MySQL numeric functions are used primarily for numeric manipulation and/or mathematical

More information

Starting MATLAB To logon onto a Temple workstation at the Tech Center, follow the directions below.

Starting MATLAB To logon onto a Temple workstation at the Tech Center, follow the directions below. What is MATLAB? MATLAB (short for MATrix LABoratory) is a language for technical computing, developed by The Mathworks, Inc. (A matrix is a rectangular array or table of usually numerical values.) MATLAB

More information

Consider this m file that creates a file that you can load data into called rain.txt

Consider this m file that creates a file that you can load data into called rain.txt SAVING AND IMPORTING DATA FROM A DATA FILES AND PROCESSING AS A ONE DIMENSIONAL ARRAY If we save data in a file sequentially than we can call it back sequentially into a row vector. Consider this m file

More information

Case Study: Black-Box Testing

Case Study: Black-Box Testing Case Study: Black-Box Testing Software Testing and Verification Lecture 6.1 Prepared by Stephen M. Thebaut, Ph.D. University of Florida Boom! Bang! Pow! The following case study illustrates the application

More information

CSI31 Lecture 5. Topics: 3.1 Numeric Data Types 3.2 Using the Math Library 3.3 Accumulating Results: Factorial

CSI31 Lecture 5. Topics: 3.1 Numeric Data Types 3.2 Using the Math Library 3.3 Accumulating Results: Factorial CSI31 Lecture 5 Topics: 3.1 Numeric Data Types 3.2 Using the Math Library 3.3 Accumulating Results: Factorial 1 3.1 Numberic Data Types When computers were first developed, they were seen primarily as

More information

NAN propagation versus fault trapping in floating point code

NAN propagation versus fault trapping in floating point code NAN propagation versus fault trapping in floating point code By Agner Fog. Technical University of Denmark. Copyright 2018. Last updated 2018-05-24. Contents 1 Introduction... 1 2 Fault trapping... 1 3

More information

A General Introduction to Matlab

A General Introduction to Matlab Master Degree Course in ELECTRONICS ENGINEERING http://www.dii.unimore.it/~lbiagiotti/systemscontroltheory.html A General Introduction to Matlab e-mail: luigi.biagiotti@unimore.it http://www.dii.unimore.it/~lbiagiotti

More information

Computational Physics

Computational Physics Computational Physics Python Programming Basics Prof. Paul Eugenio Department of Physics Florida State University Jan 17, 2019 http://hadron.physics.fsu.edu/~eugenio/comphy/ Announcements Exercise 0 due

More information

CS110: PROGRAMMING LANGUAGE I

CS110: PROGRAMMING LANGUAGE I CS110: PROGRAMMING LANGUAGE I Computer Science Department Lecture 8: Methods Lecture Contents: 2 Introduction Program modules in java Defining Methods Calling Methods Scope of local variables Passing Parameters

More information

Statistical Data Analysis: Python Tutorial

Statistical Data Analysis: Python Tutorial 1 October 4, 2017 Statistical Data Analysis: Python Tutorial Dr A. J. Bevan, Contents 1 Getting started 1 2 Basic calculations 2 3 More advanced calculations 4 4 Data sets 5 4.1 CSV file input.............................................

More information

Introduction to C Language

Introduction to C Language Introduction to C Language Instructor: Professor I. Charles Ume ME 6405 Introduction to Mechatronics Fall 2006 Instructor: Professor Charles Ume Introduction to C Language History of C Language In 1972,

More information

PASS$MOCK$EXAM$ $FOR$PRACTICE$ONLY$

PASS$MOCK$EXAM$ $FOR$PRACTICE$ONLY$ PASS$MOCK$EXAM$ $FOR$PRACTICE$ONLY$ Course: ECOR 1606 Facilitator: Dane Levere Dates and locations of take-up: Wednesday April 23 rd, 2014 12:00pm-3:00pm LA C164 IMPORTANT: It is most beneficial to you

More information

Lecture 1: What is MATLAB?

Lecture 1: What is MATLAB? Lecture 1: What is MATLAB? Dr. Mohammed Hawa Electrical Engineering Department University of Jordan EE201: Computer Applications. See Textbook Chapter 1. MATLAB MATLAB (MATrix LABoratory) is a numerical

More information

Programming in C Quick Start! Biostatistics 615 Lecture 4

Programming in C Quick Start! Biostatistics 615 Lecture 4 Programming in C Quick Start! Biostatistics 615 Lecture 4 Last Lecture Analysis of Algorithms Empirical Analysis Mathematical Analysis Big-Oh notation Today Basics of programming in C Syntax of C programs

More information

The Math Class (Outsource: Math Class Supplement) Random Numbers. Lab 06 Math Class

The Math Class (Outsource: Math Class Supplement) Random Numbers. Lab 06 Math Class The (Outsource: Supplement) The includes a number of constants and methods you can use to perform common mathematical functions. A commonly used constant found in the Math class is Math.PI which is defined

More information

A. Matrix-wise and element-wise operations

A. Matrix-wise and element-wise operations USC GSBME MATLAB CLASS Reviewing previous session Second session A. Matrix-wise and element-wise operations A.1. Matrix-wise operations So far we learned how to define variables and how to extract data

More information

ISO/IEC 2014 All rights reserved Working Group Draft February 9, Committee identification: ISO/IEC JTC 1/SC 22/WG 14

ISO/IEC 2014 All rights reserved Working Group Draft February 9, Committee identification: ISO/IEC JTC 1/SC 22/WG 14 ISO/IEC 14 All rights reserved Working Group Draft February 9, 14 ISO/IEC JTC 1/SC 22/WG 14 N1797 Date: yyyy-mm-dd Reference number of document: ISO/IEC TS 18661-4 Committee identification: ISO/IEC JTC

More information

This is an extract from: A Source Book from The Open Group

This is an extract from: A Source Book from The Open Group This is an extract from: A Source Book from The Open Group The Authorized Guide to the Single UNIX Specification, Version 3 The Open Group Copyright January 2005, The Open Group All rights reserved. No

More information

AMD CPU Libraries User Guide Version 1.3

AMD CPU Libraries User Guide Version 1.3 AMD CPU Libraries User Guide Version 1.3 Contents 1. Introduction... 4 2. BLIS... 5 2.1. Installation... 5 2.1.1. Build BLIS from source... 5 2.1.1.1. Single-thread BLIS... 5 2.1.1.2. Multi-threaded BLIS...

More information

DM536 / DM550 Part 1 Introduction to Programming. Peter Schneider-Kamp.

DM536 / DM550 Part 1 Introduction to Programming. Peter Schneider-Kamp. DM536 / DM550 Part 1 Introduction to Programming Peter Schneider-Kamp petersk@imada.sdu.dk! http://imada.sdu.dk/~petersk/dm536/! CALLING FUNCTIONS 2 Calling Functions so far we have seen three different

More information

EXCEL HINTS. Navigation Nomenclature (for this class)

EXCEL HINTS. Navigation Nomenclature (for this class) EXCEL HINTS D. J. Dal Bello, revised July 2006 The purpose of this handout is to provide an introduction to, and hints on, using Microsoft Excel. Experimenting with Excel (or any computer program) is the

More information

Computer Programming 5th Week loops (do-while, for), Arrays, array operations, C libraries

Computer Programming 5th Week loops (do-while, for), Arrays, array operations, C libraries Computer Programming 5th Week loops (do-while, for), Arrays, array operations, C libraries Hazırlayan Asst. Prof. Dr. Tansu Filik Computer Programming Previously on Bil 200 Low-Level I/O getchar, putchar,

More information

High Level Scripting. Gino Tosti University & INFN Perugia. 06/09/2010 SciNeGhe Data Analysis Tutorial

High Level Scripting. Gino Tosti University & INFN Perugia. 06/09/2010 SciNeGhe Data Analysis Tutorial High Level Scripting Part I Gino Tosti University & INFN Perugia What is a script? Scripting Languages It is a small program able to automate a repetitive and boring job; It is a list of commands that

More information

Calling Prewritten Functions in C

Calling Prewritten Functions in C Calling Prewritten Functions in C We've already called two prewritten functions that are found in the C library stdio.h: printf, scanf. The function specifications for these two are complicated (they allow

More information