GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
M_REAL(3) FreeBSD Library Functions Manual M_REAL(3)

M_RealAgar-Math real number operations

#include <agar/core.h>
#include <agar/gui.h>
#include <agar/math/m.h>

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) or double (64-bit, DOUBLE_PRECISION is defined).

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, however, 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.

M_Real
(AG_DataSource *ds);


void
(AG_DataSource *ds, M_Real *r);


void
(AG_DataSource *ds, M_Real r);

The () 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.

The library defines the following fundamental constants:

Euler's constant
log_2 e
log_10 e
log_e 2
log_e 10
pi
pi/2
pi/4
1/pi
2/pi
2/sqrt(pi)
sqrt(2)
1/sqrt(2)

The following constants describe the limitations of the memory format for the current precision mode:

Minimum exponent.
Maximum exponent.
Precision of the significand in bits.
M_PRECISION/2 (rounded up).
Highest representible number.
Machine epsilon, or unit roundoff.
A very small number, close to M_MACHEP.
A very large number.
Representation of infinity.

M_Real
(M_Real x);


M_Real
(M_Real x);


M_Real
(M_Real x);


M_Real
(M_Real x);


M_Real
(M_Real x);


M_Real
(M_Real x);


M_Real
(M_Real x);


M_Real
(M_Real x);


M_Real
(M_Real x);


M_Real
(M_Real x);


M_Real
(M_Real x);


M_Real
(M_Real x);


M_Real
(M_Real x);


M_Real
(M_Real x);


M_Real
(M_Real x);


M_Real
(M_Real x);


M_Real
(M_Real x);


M_Real
(M_Real x);


M_Real
(M_Real x);


M_Real
(M_Real x);


M_Real
(M_Real y, M_Real x);


M_Real
(M_Real x, M_Real y);


M_Real
(M_Real x);


M_Real
(M_Real x);


M_Real
(M_Real x, M_Real y);


M_Real
(M_Real x, int *exp);


M_Real
(M_Real x, int *exp);


M_Real
(M_Real x);


M_Real
(M_Real x);


int
(M_Real x);


int
(M_Real x);

() returns the natural logarithm of x.

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

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

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

(), 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_Sec() and M_Csc() return the cotangent, secant and cosecant of x.

(), 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.

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

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

() returns the absolute value of x.

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

() returns x raised to the power of y.

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

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

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

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

() evaluates to 1 if x represents infinity.

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

The M_Real structure first appeared in Agar 1.3.4.

December 21, 2022 Agar 1.7

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.