Numworks Epsilon
1.4.1
Graphing Calculator Operating System
Main Page
Related Pages
+
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
x
y
z
+
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
+
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Typedefs
Enumerations
Enumerator
+
Classes
Class List
Class Index
Class Hierarchy
+
Class 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
x
y
z
~
+
Functions
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
+
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Typedefs
+
Enumerations
a
b
c
d
e
f
l
m
o
p
q
r
s
t
w
Enumerator
+
Related Functions
a
b
c
d
f
g
h
i
l
m
n
o
p
r
s
t
u
w
+
Files
File List
+
File 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
x
z
+
Functions
_
a
b
c
d
e
f
g
i
k
l
m
n
o
p
q
r
s
t
u
v
w
z
+
Variables
_
a
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
+
Typedefs
a
b
c
d
e
f
g
i
k
m
n
q
r
s
u
v
Enumerations
+
Enumerator
i
l
m
p
r
s
u
+
Macros
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
w
x
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
s_modf.c
Go to the documentation of this file.
1
/* @(#)s_modf.c 5.1 93/09/24 */
2
/*
3
* ====================================================
4
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
5
*
6
* Developed at SunPro, a Sun Microsystems, Inc. business.
7
* Permission to use, copy, modify, and distribute this
8
* software is freely granted, provided that this notice
9
* is preserved.
10
* ====================================================
11
*/
12
13
/*
14
* modf(double x, double *iptr)
15
* return fraction part of x, and return x's integral part in *iptr.
16
* Method:
17
* Bit twiddling.
18
*
19
* Exception:
20
* No exception.
21
*/
22
23
#include "math.h"
24
#include "
math_private.h
"
25
26
static
const
double
one
= 1.0;
27
28
double
29
modf
(
double
x,
double
*iptr)
30
{
31
int32_t
i0,i1,j0;
32
u_int32_t
i;
33
EXTRACT_WORDS
(i0,i1,x);
34
j0 = ((i0>>20)&0x7ff)-0x3ff;
/* exponent of x */
35
if
(j0<20) {
/* integer part in high x */
36
if
(j0<0) {
/* |x|<1 */
37
INSERT_WORDS
(*iptr,i0&0x80000000,0);
/* *iptr = +-0 */
38
return
x;
39
}
else
{
40
i = (0x000fffff)>>j0;
41
if
(((i0&i)|i1)==0) {
/* x is integral */
42
u_int32_t
high;
43
*iptr = x;
44
GET_HIGH_WORD
(high,x);
45
INSERT_WORDS
(x,high&0x80000000,0);
/* return +-0 */
46
return
x;
47
}
else
{
48
INSERT_WORDS
(*iptr,i0&(~i),0);
49
return
x - *iptr;
50
}
51
}
52
}
else
if
(j0>51) {
/* no fraction part */
53
u_int32_t
high;
54
*iptr = x*
one
;
55
GET_HIGH_WORD
(high,x);
56
INSERT_WORDS
(x,high&0x80000000,0);
/* return +-0 */
57
return
x;
58
}
else
{
/* fraction part in low x */
59
i = ((
u_int32_t
)(0xffffffff))>>(j0-20);
60
if
((i1&i)==0) {
/* x is integral */
61
u_int32_t
high;
62
*iptr = x;
63
GET_HIGH_WORD
(high,x);
64
INSERT_WORDS
(x,high&0x80000000,0);
/* return +-0 */
65
return
x;
66
}
else
{
67
INSERT_WORDS
(*iptr,i0,i1&(~i));
68
return
x - *iptr;
69
}
70
}
71
}
GET_HIGH_WORD
#define GET_HIGH_WORD(i, d)
Definition:
math_private.h:269
one
#define one
Definition:
k_tan.c:68
u_int32_t
uint32_t u_int32_t
Definition:
types.h:10
EXTRACT_WORDS
#define EXTRACT_WORDS(ix0, ix1, d)
Definition:
math_private.h:259
INSERT_WORDS
#define INSERT_WORDS(d, ix0, ix1)
Definition:
math_private.h:287
modf
double modf(double x, double *iptr)
Definition:
s_modf.c:29
int32_t
signed int int32_t
Definition:
stdint.h:11
math_private.h
epsilon
liba
src
external
openbsd
s_modf.c
Generated by
1.8.14