NEST main@caf0ae8
 
Loading...
Searching...
No Matches
numerics.h
Go to the documentation of this file.
1/*
2 * numerics.h
3 *
4 * This file is part of NEST.
5 *
6 * Copyright (C) 2004 The NEST Initiative
7 *
8 * NEST is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * NEST is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with NEST. If not, see <http://www.gnu.org/licenses/>.
20 *
21 */
22
23#ifndef NUMERICS_H
24#define NUMERICS_H
25
26// Generated includes:
27#include "config.h"
28
29// C++ includes:
30#include <cassert>
31#include <cmath>
32#include <cstddef>
33#include <limits>
34
35namespace numerics
36{
37
38extern const double e;
39extern const double pi;
40extern const double nan;
41extern const double sqrt_log_two;
42
43inline double
44expm1( double x )
45{
46 return std::expm1( x );
47}
48
49template < typename T >
50inline bool
51is_nan( T f )
52{
53 return std::isnan( f );
54}
55}
56
57
58// later also in namespace
66long ld_round( double );
67
75double dround( double );
76
80double dtruncate( double );
81
86bool is_integer( double );
87
93long mod_inverse( long a, long m );
94
134size_t first_index( long period, long phase0, long step, long phase );
135
136#endif
Definition numerics.h:36
const double nan
Definition numerics.cpp:36
double expm1(double x)
Definition numerics.h:44
bool is_nan(T f)
Definition numerics.h:51
const double sqrt_log_two
Definition numerics.cpp:37
const double e
Definition numerics.cpp:32
const double pi
Definition numerics.cpp:33
double dround(double)
Round to nearest int, rounding midpoints upwards.
Definition numerics.cpp:47
long mod_inverse(long a, long m)
Returns inverse of integer a modulo m.
Definition numerics.cpp:79
bool is_integer(double)
Returns true if n is integer up to rounding error.
Definition numerics.cpp:62
long ld_round(double)
Round to nearest int, rounding midpoints upwards.
Definition numerics.cpp:41
double dtruncate(double)
Return integer part of argument.
Definition numerics.cpp:53
size_t first_index(long period, long phase0, long step, long phase)
Return first matching index for entry in container with double periodicity.
Definition numerics.cpp:142