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
This commit is contained in:
Elliott Hughes
2014-04-11 17:02:20 -07:00
parent 0558906866
commit 02c78a3867
13 changed files with 300 additions and 296 deletions

View File

@@ -239,6 +239,12 @@ TEST(math, finite) {
ASSERT_FALSE(finite(HUGE_VAL));
}
TEST(math, isinf_function) {
// The isinf macro deals with all three types; the isinf function is for doubles.
ASSERT_FALSE((isinf)(123.0));
ASSERT_TRUE((isinf)(HUGE_VAL));
}
TEST(math, __isinff) {
ASSERT_FALSE(__isinff(123.0f));
ASSERT_TRUE(__isinff(HUGE_VALF));
@@ -249,6 +255,12 @@ TEST(math, __isinfl) {
ASSERT_TRUE(__isinfl(HUGE_VALL));
}
TEST(math, isnan_function) {
// The isnan macro deals with all three types; the isnan function is for doubles.
ASSERT_FALSE((isnan)(123.0));
ASSERT_TRUE((isnan)(nan("")));
}
TEST(math, __isnanf) {
ASSERT_FALSE(__isnanf(123.0f));
ASSERT_TRUE(__isnanf(nanf("")));