00001 /* 00002 * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands. 00003 * See the copyright notice in the ACK home directory, in the file "Copyright". 00004 * 00005 * Author: Ceriel J.H. Jacobs 00006 */ 00007 /* $Header: /opt/proj/minix/cvsroot/src/lib/math/floor.c,v 1.1.1.1 2005/04/21 14:56:26 beng Exp $ */ 00008 00009 #include <math.h> 00010 00011 double 00012 floor(double x) 00013 { 00014 double val; 00015 00016 return modf(x, &val) < 0 ? val - 1.0 : val ; 00017 /* this also works if modf always returns a positive 00018 fractional part 00019 */ 00020 }
1.4.6