The R Project SVN R

Rev

Rev 42302 | Rev 64656 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 42302 Rev 42303
Line -... Line 1...
-
 
1
/*
-
 
2
 *  Mathlib : A C Library of Special Functions
-
 
3
 *  Copyright (C) 1998 Ross Ihaka
-
 
4
 *
-
 
5
 *  This program is free software; you can redistribute it and/or modify
-
 
6
 *  it under the terms of the GNU General Public License as published by
-
 
7
 *  the Free Software Foundation; either version 2 of the License, or
-
 
8
 *  (at your option) any later version.
-
 
9
 *
-
 
10
 *  This program is distributed in the hope that it will be useful,
-
 
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
-
 
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-
 
13
 *  GNU General Public License for more details.
-
 
14
 *
-
 
15
 *  You should have received a copy of the GNU General Public License
-
 
16
 *  along with this program; if not, a copy is available at
-
 
17
 *  http://www.r-project.org/Licenses/
-
 
18
 *
-
 
19
 *  SYNOPSIS
-
 
20
 *
-
 
21
 *    #include <Rmath.h>
-
 
22
 *    double ftrunc(double x);
-
 
23
 *
-
 
24
 *  DESCRIPTION
-
 
25
 *
-
 
26
 *    Truncation toward zero.
-
 
27
 */
-
 
28
 
-
 
29
#include "nmath.h"
-
 
30
 
-
 
31
double ftrunc(double x)
-
 
32
{
-
 
33
	if(x >= 0) return floor(x);
-
 
34
	else return ceil(x);
-
 
35
}