Loading [MathJax]/extensions/TeX/AMSsymbols.js
TMB Documentation
v1.9.11
Main Page
Related Pages
Modules
+
Namespaces
Namespace List
+
Namespace Members
+
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
+
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
Enumerations
+
Classes
Class List
Class Hierarchy
+
Class Members
+
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
y
+
Functions
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
x
y
+
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
Typedefs
Enumerations
Enumerator
+
Files
File List
+
File Members
+
All
a
b
c
d
g
i
l
m
n
o
p
q
r
s
t
v
+
Functions
a
b
c
d
i
l
m
n
o
p
q
r
s
+
Macros
a
d
g
n
p
r
s
t
v
Examples
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
Pages
TMB
inst
include
tiny_ad
beta
d1mach.cpp
1
/*
2
* Mathlib - A Mathematical Function Library
3
* Copyright (C) 1998 Ross Ihaka
4
* Copyright (C) 2000-2014 The R Core Team
5
*
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, a copy is available at
18
* https://www.R-project.org/Licenses/
19
*/
20
21
/* NaNs propagated correctly */
22
23
24
/*-- FIXME: Eliminate calls to these
25
* ===== o from C code when
26
* o it is only used to initialize "static" variables (threading)
27
* and use the DBL_... constants instead
28
*/
29
30
#include "nmath.h"
31
32
template
<
class
T>
33
attribute_hidden
double
Rf_d1mach(T i)
34
{
35
switch
(i) {
36
case
1:
return
DBL_MIN;
37
case
2:
return
DBL_MAX;
38
39
case
3:
/* = FLT_RADIX ^ - DBL_MANT_DIG
40
for IEEE: = 2^-53 = 1.110223e-16 = .5*DBL_EPSILON */
41
return
0.5*DBL_EPSILON;
42
43
case
4:
/* = FLT_RADIX ^ (1- DBL_MANT_DIG) =
44
for IEEE: = 2^-52 = DBL_EPSILON */
45
return
DBL_EPSILON;
46
47
case
5:
return
M_LOG10_2;
48
49
default
:
return
0.0;
50
}
51
}
License:
GPL v2