Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – planix.SVN – Blame – /os/branches/feature_tlsv12/sys/src/ape/lib/ap/math/floor.c – Rev 2

Subversion Repositories planix.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#include <math.h>
2
/*
3
 * floor and ceil-- greatest integer <= arg
4
 * (resp least >=)
5
 */
6
 
7
double
8
floor(double d)
9
{
10
	double fract;
11
 
12
	if(d < 0) {
13
		fract = modf(-d, &d);
14
		if(fract != 0.0)
15
			d += 1;
16
		d = -d;
17
	} else
18
		modf(d, &d);
19
	return d;
20
}
21
 
22
double
23
ceil(double d)
24
{
25
	return -floor(-d);
26
}