1*40865Sbostic /*- 2*40865Sbostic * Copyright (c) 1979 The Regents of the University of California. 3*40865Sbostic * All rights reserved. 4*40865Sbostic * 5*40865Sbostic * %sccs.include.redist.c% 6*40865Sbostic */ 71649Smckusick 8*40865Sbostic #ifndef lint 9*40865Sbostic static char sccsid[] = "@(#)EXPO.c 1.3 (Berkeley) 04/09/90"; 10*40865Sbostic #endif /* not lint */ 111649Smckusick 123003Smckusic long 131649Smckusick EXPO(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