140865Sbostic /*- 2*62092Sbostic * Copyright (c) 1979, 1993 3*62092Sbostic * The Regents of the University of California. All rights reserved. 440865Sbostic * 540865Sbostic * %sccs.include.redist.c% 640865Sbostic */ 71649Smckusick 840865Sbostic #ifndef lint 9*62092Sbostic static char sccsid[] = "@(#)EXPO.c 8.1 (Berkeley) 06/06/93"; 1040865Sbostic #endif /* not lint */ 111649Smckusick 123003Smckusic long EXPO(value)131649SmckusickEXPO(value) 141649Smckusick 153003Smckusic double value; 161649Smckusick { 173003Smckusic register int retval; 183003Smckusic register char *cp; 193003Smckusic char sign, buf[30]; 203003Smckusic extern char *index(); 213003Smckusic 223003Smckusic if (value == 0.0) 231649Smckusick return 0; 243003Smckusic sprintf(buf, "%.1e", value); 253003Smckusic cp = index(buf, 'e') + 1; 263003Smckusic sign = *cp++; 273003Smckusic retval = 0; 283003Smckusic while (*cp) 293003Smckusic retval = retval * 10 + *cp++ - '0'; 303003Smckusic return sign == '-' ? -retval : retval; 311649Smckusick } 32