projects
/
oweals
/
musl.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
make socketcall types common as they are same for all architectures
[oweals/musl.git]
/
src
/
math
/
rintf.c
1
#include <math.h>
2
#include <stdint.h>
3
4
float rintf(float x)
5
{
6
union {float f; uint32_t i;} u = {x};
7
int e = u.i>>23 & 0xff;
8
int s = u.i>>31;
9
float_t y;
10
11
if (e >= 0x7f+23)
12
return x;
13
if (s)
14
y = (float)(x - 0x1p23f) + 0x1p23f;
15
else
16
y = (float)(x + 0x1p23f) - 0x1p23f;
17
if (y == 0)
18
return s ? -0.0f : 0.0f;
19
return y;
20
}