Last change
on this file since 373 was 352, checked in by coas-nagasima, 6 years ago |
arm向けASP3版ECNLを追加
|
-
Property svn:eol-style
set to
native
-
Property svn:mime-type
set to
text/x-csrc;charset=UTF-8
|
File size:
303 bytes
|
Rev | Line | |
---|
[352] | 1 | #include "libm.h"
|
---|
| 2 |
|
---|
| 3 | double trunc(double x)
|
---|
| 4 | {
|
---|
| 5 | union {double f; uint64_t i;} u = {x};
|
---|
| 6 | int e = (int)(u.i >> 52 & 0x7ff) - 0x3ff + 12;
|
---|
| 7 | uint64_t m;
|
---|
| 8 |
|
---|
| 9 | if (e >= 52 + 12)
|
---|
| 10 | return x;
|
---|
| 11 | if (e < 12)
|
---|
| 12 | e = 1;
|
---|
| 13 | m = -1ULL >> e;
|
---|
| 14 | if ((u.i & m) == 0)
|
---|
| 15 | return x;
|
---|
| 16 | FORCE_EVAL(x + 0x1p120f);
|
---|
| 17 | u.i &= ~m;
|
---|
| 18 | return u.f;
|
---|
| 19 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.