Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
M_REAL(3)		 BSD Library Functions Manual		     M_REAL(3)

NAME
     M_Real -- Agar-Math real number operations

SYNOPSIS
     #include <agar/math.h>

DESCRIPTION
     Real numbers in Agar-Math are most	often described	using the M_Real type.
     Depending on which	precision mode the library was compiled	against	(see
     the --with-<mode>-fp configure option), M_Real may	expand to float
     (32-bit, SINGLE_PRECISION is defined), double (64-bit, DOUBLE_PRECISION
     is	defined) or long double	(80-bit	or 128-bit, QUAD_PRECISION is de-
     fined).

     Most Agar-Math structures use M_Real to represent floating-point numbers.
     The real and imaginary parts of M_Complex(3), and the elements of
     M_Vector(3) and M_Matrix(3) are all stored	as M_Real values.  Note, how-
     ever, that	fixed-size types such as M_Vector2, M_Vector3, M_Vector4, and
     M_Matrix44	may or may not use a different precision (depending on the
     availability of SIMD instructions such as AltiVec and SSE).  The general
     M_Vector and M_Matrix types are always guaranteed to use M_Real.

INITIALIZATION
     M_Real M_ReadReal(AG_DataSource *ds)

     void M_CopyReal(AG_DataSource *ds,	M_Real *r)

     void M_WriteReal(AG_DataSource *ds, M_Real	r)

     The M_ReadReal() function reads a complex number from an AG_DataSource(3)
     and returns it.  The M_CopyReal() variant returns the number in r.
     M_WriteReal() writes a real number	to a data source.

CONSTANTS
     The library defines the following fundamental constants:
     M_E	  Euler's constant
     M_LOG2E	  log_2	e
     M_LOG10E	  log_10 e
     M_LN2	  log_e	2
     M_LN10	  log_e	10
     M_PI	  pi
     M_PI_2	  pi/2
     M_PI_4	  pi/4
     M_1_PI	  1/pi
     M_2_PI	  2/pi
     M_2_SQRTPI	  2/sqrt(pi)
     M_SQRT2	  sqrt(2)
     M_SQRT1_2	  1/sqrt(2)

     The following constants describe the limitations of the memory format for
     the current precision mode:
     M_EXPMIN	     Minimum exponent.
     M_EXPMAX	     Maximum exponent.
     M_PRECISION     Precision of the significand in bits.
     M_PRECISION_2   M_PRECISION/2 (rounded up).
     M_NUMMAX	     Highest representible number.
     M_MACHEP	     Machine epsilon, or unit roundoff.
     M_TINYVAL	     A very small number, close	to M_MACHEP.
     M_HUGEVAL	     A very large number.
     M_INFINITY	     Representation of infinity.

STANDARD MATH ROUTINES
     M_Real M_Log(M_Real x)

     M_Real M_Exp(M_Real x)

     M_Real M_ExpM1(M_Real x)

     M_Real M_Sqrt(M_Real x)

     M_Real M_Cbrt(M_Real x)

     M_Real M_Sin(M_Real x)

     M_Real M_Cos(M_Real x)

     M_Real M_Tan(M_Real x)

     M_Real M_Sinh(M_Real x)

     M_Real M_Cosh(M_Real x)

     M_Real M_Tanh(M_Real x)

     M_Real M_Cot(M_Real x)

     M_Real M_Sec(M_Real x)

     M_Real M_Csc(M_Real x)

     M_Real M_Asin(M_Real x)

     M_Real M_Acos(M_Real x)

     M_Real M_Atan(M_Real x)

     M_Real M_Asinh(M_Real x)

     M_Real M_Acosh(M_Real x)

     M_Real M_Atanh(M_Real x)

     M_Real M_Atan2(M_Real y, M_Real x)

     M_Real M_Hypot2(M_Real x, M_Real y)

     M_Real M_Fabs(M_Real x)

     M_Real M_Sgn(M_Real x)

     M_Real M_Pow(M_Real x, M_Real y)

     M_Real M_Frexp(M_Real x, int *exp)

     M_Real M_Ldexp(M_Real x, int *exp)

     M_Real M_Ceil(M_Real x)

     M_Real M_Floor(M_Real x)

     int M_IsNaN(M_Real	x)

     int M_IsInf(M_Real	x)

     M_Log() returns the natural logarithm of x.

     M_Exp() returns the value of e, raised to the power of x.

     The M_ExpM1() routine returns the equivalent of M_Exp(x)-1.  Numerical
     roundoff error is prevented in the	case of	x being	near zero.

     M_Sqrt() returns the square root of x.  M_Cbrt() returns the cube root of
     x.

     M_Sin(), M_Cos() and M_Tan() return the sine, cosine and tangent of x
     (given in radians).  M_Sinh(), M_Cosh(), M_Tanh() return the hyperbolic
     sine, cosine and tangent of x.

     M_Cot(), M_Sec() and M_Csc() return the cotangent,	secant and cosecant of
     x.

     M_Asin(), M_Acos()	and M_Atan() return the	arc sine, arc cosine and arc
     tangent of	x.  M_Asinh(), M_Acosh() and M_Atanh() return the hyperbolic
     arc sine, arc cosine and arc tangent of x.

     M_Atan2() returns the equivalent of Atan(y/x), except that	the sign of
     the result	is determined from the signs of	both arguments.

     M_Hypot2()	computes the length of the hypotenuse of a right-angle trian-
     gle with the right-angle side lengths of x	and y.

     M_Fabs() returns the absolute value of x.

     The sign function M_Sgn() returns +1.0 if the sign	of x is	positive or
     -1.0 if the sign is negative.

     M_Pow() returns x raised to the power of y.

     M_Frexp() returns the normalized fraction for x, and writes the exponent
     to	exp.

     M_Ldexp() returns the result of multiplication of x by 2 to the power
     exp.

     M_Ceil() rounds x up to the nearest integer.  M_Floor() rounds down to
     the nearest integer.

     M_IsNan() evaluates to 1 if x is "not a number".

     M_IsInf() evaluates to 1 if x represents infinity.

SEE ALSO
     AG_DataSource(3), AG_Intro(3), M_Complex(3), M_Geometry(3), M_Matrix(3),
     M_Quaternion(3), M_Vector(3)

HISTORY
     The M_Real	structure first	appeared in Agar 1.3.4.

BSD				 July 18, 2009				   BSD

NAME | SYNOPSIS | DESCRIPTION | INITIALIZATION | CONSTANTS | STANDARD MATH ROUTINES | SEE ALSO | HISTORY

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=M_Real&sektion=3&manpath=FreeBSD+13.0-RELEASE+and+Ports>

home | help