1 #include "Local.h" /* standard header file */
4 /********************************************************************/
7 /* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */
8 /* Date: 13 Jun 1995 */
9 /* Programmer: CARL MCCALLA */
12 /* Abstract: Convert a character string fraction into a */
13 /* decimal (floating point) number. */
15 /* External Functions Called: */
18 /* Input: string - a pointer to a character string frac- */
20 /* Output: A decimal (floating point) number. */
22 /* Modification History: */
25 /********************************************************************/
27 float fracPart( char *string )
30 /***************************/
31 /* DECLARE LOCAL VARIABLES */
32 /***************************/
40 /*************************/
41 /* START BODY OF ROUTINE */
42 /*************************/
44 slash = strchr(string, '/');
46 memset(buf , '\0', 6);
47 strncpy( buf, string, slash-string);
49 numerator = (float) atoi(buf);
51 memset(buf , '\0', 6);
52 strcpy( buf, slash+1);
54 denominator = (float) atoi(buf);
56 return (numerator/denominator);