~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Tina4/src/math/util/math_util.c

Version: ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /**@(#)Maths (simple functions, eg imax3: (returns biggest of 3 ints)
  2 **/
  3 
  4 #include <math.h>
  5 #include <tina/sys.h>
  6 #include <tina/math.h>
  7 #include <tina/mathfuncs.h>
  8 
  9 double  tina_acos(double c)
 10 {
 11     if (c > 1.0)
 12         c = 1.0;
 13     else if (c < -1.0)
 14         c = -1.0;
 15     return (acos(c));
 16 }
 17 
 18 double  sqr(double x)
 19 {
 20     return (x * x);
 21 }
 22 
 23 double  dist2(double x1, double y1, double x2, double y2)
 24 {
 25     double  dx = x2 - x1;
 26     double  dy = y2 - y1;
 27 
 28     return (sqrt(dx * dx + dy * dy));
 29 }
 30 
 31 int     imin(int x, int y)
 32 {
 33     return ((x < y) ? x : y);
 34 }
 35 
 36 int     imax(int x, int y)
 37 {
 38     return ((x > y) ? x : y);
 39 }
 40 
 41 double  fmin(double x, double y)
 42 {
 43     return ((x < y) ? x : y);
 44 }
 45 
 46 double  fmax(double x, double y)
 47 {
 48     return ((x > y) ? x : y);
 49 }
 50 
 51 int     imin3(int x, int y, int z)
 52 {
 53     return ((x < (y = imin(y, z))) ? x : y);
 54 }
 55 
 56 int     imax3(int x, int y, int z)
 57 {
 58     return ((x > (y = imax(y, z))) ? x : y);
 59 }
 60 
 61 double  fmin3(double x, double y, double z)
 62 {
 63     return ((x < (y = fmin(y, z))) ? x : y);
 64 }
 65 
 66 double  fmax3(double x, double y, double z)
 67 {
 68     return ((x > (y = fmax(y, z))) ? x : y);
 69 }
 70 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.