////////////////////////////////////////////////////////////////////////////// // AMath.c // // Jorge Vittes // // Additional Math functions for doing things ///////////////////////////////////////////////////////////////////////////// #include #include #include #include "AMath.h" /////////////////////////////////////////////////// // Find the minimum of two doubles ////////////////////////////////////////////////// double dmin(double a, double b) { if (a > b) return b; else return a; } ///////////////////////////////////////////////// // Find the minimum of three doubles ///////////////////////////////////////////////// double min3(double a, double b, double c) { if(a > b) { if(b > c) return c; else return b; } else { if(a > c) return c; else return a; } } ///////////////////////////////////////////////// // return the max of two doubles //////////////////////////////////////////////// double dmax(double a, double b) { if(a > b) return a; else return b; } ///////////////////////////////////////////////// // Return the maximum of two ints ///////////////////////////////////////////////// int imax(int a, int b) { if(a > b) return a; return b; } /////////////////////////////////////////////// // Find the maximum of three doubles /////////////////////////////////////////////// double max3(double a, double b, double c) { if(a > b) { if(a > c) return a; else return c; } else { if(b > c) return b; else return c; } }