summaryrefslogtreecommitdiffstats
path: root/libc/stdio
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2014-04-11 17:02:20 -0700
committerElliott Hughes <enh@google.com>2014-04-14 14:35:47 -0700
commit02c78a386739a8a2b3007efeb00a9ca04132100a (patch)
tree6679bef40da8b7fbe6b3c5a479eb5c2e4e035708 /libc/stdio
parent055890686636faddbb6d5d407c67f5dcc53ac865 (diff)
downloadbionic-02c78a386739a8a2b3007efeb00a9ca04132100a.tar.gz
bionic-02c78a386739a8a2b3007efeb00a9ca04132100a.tar.bz2
bionic-02c78a386739a8a2b3007efeb00a9ca04132100a.zip
Reimplement isinf/isnan/fpclassify.
Also move isinf and isnan into libc like everyone else. Also move fpclassify to libc like the BSDs (but unlike glibc). We need this to be able to upgrade our float/double/long double parsing to gdtoa. Also add some missing aliases. We now have all of: isnan, __isnan, isnanf, __isnanf, isnanl, __isnanl, isinf, __isinf, isinff, __isinff, isinfl, __isinfl, __fpclassify, __fpclassifyd, __fpclassifyf, __fpclassifyl. Bug: 13469877 Change-Id: I407ffbac06c765a6c5fffda8106c37d7db04f27d
Diffstat (limited to 'libc/stdio')
-rw-r--r--libc/stdio/vfprintf.c35
1 files changed, 2 insertions, 33 deletions
diff --git a/libc/stdio/vfprintf.c b/libc/stdio/vfprintf.c
index d2c315daa..e33c10504 100644
--- a/libc/stdio/vfprintf.c
+++ b/libc/stdio/vfprintf.c
@@ -154,12 +154,6 @@ static int exponent(char *, int, int);
#define STATIC_ARG_TBL_SIZE 8 /* Size of static argument table. */
-/* BIONIC: do not link libm for only two rather simple functions */
-#ifdef FLOATING_POINT
-static int _my_isinf(double);
-static int _my_isnan(double);
-#endif
-
/*
* Macros for converting digits to letters and vice versa
*/
@@ -543,14 +537,14 @@ reswitch: switch (ch) {
}
/* do this before tricky precision changes */
- if (_my_isinf(_double)) {
+ if (isinf(_double)) {
if (_double < 0)
sign = '-';
cp = "Inf";
size = 3;
break;
}
- if (_my_isnan(_double)) {
+ if (isnan(_double)) {
cp = "NaN";
size = 3;
break;
@@ -1331,29 +1325,4 @@ exponent(char *p0, int exp, int fmtch)
return (p - p0);
}
-
-/* BIONIC */
-#include <machine/ieee.h>
-typedef union {
- double d;
- struct ieee_double i;
-} ieee_u;
-
-static int
-_my_isinf (double value)
-{
- ieee_u u;
-
- u.d = value;
- return (u.i.dbl_exp == 2047 && u.i.dbl_frach == 0 && u.i.dbl_fracl == 0);
-}
-
-static int
-_my_isnan (double value)
-{
- ieee_u u;
-
- u.d = value;
- return (u.i.dbl_exp == 2047 && (u.i.dbl_frach != 0 || u.i.dbl_fracl != 0));
-}
#endif /* FLOATING_POINT */