repo.or.cz
/
altfloat.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
floating: Add trigonometric functions.
[altfloat.git]
/
cfloat.c
blob
f79eddc483a2dc4f4c45e8a2a4f9b14de4463a78
1
#include <stdio.h>
2
#include <stdlib.h>
3
#include <errno.h>
4
#include <math.h>
5
6
#include
"cfloat.h"
7
8
int
double_to_string
(
char
*
buf
,
double
val
)
9
{
10
if
(
buf
==
NULL
)
11
return
snprintf
(
NULL
,
0
,
"%a"
,
val
);
12
return
sprintf
(
buf
,
"%a"
,
val
);
13
}
14
15
double
double_signum
(
double
val
)
16
{
17
if
(
signbit
(
val
))
18
return
-
1
;
19
return
1
;
20
}
21
22
float
double_to_float
(
double
val
)
23
{
24
return
val
;
25
}
26
27
double
float_to_double
(
float
val
)
28
{
29
return
val
;
30
}