1 /* vi: set sw=4 ts=4: */
3 * Copyright (C) 2002 by Erik Andersen <andersen@uclibc.org>
5 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
8 /***********************************************************************
9 nan, nanf, nanl - return quiet NaN
11 These functions shall return a quiet NaN, if available, with content
12 indicated through tagp.
14 If the implementation does not support quiet NaNs, these functions
17 Calls: strlen(), sprintf(), strtod()
19 ***********************************************************************/
25 double nan (const char *tagp
)
27 if (tagp
[0] != '\0') {
28 char buf
[6 + strlen (tagp
)];
29 sprintf (buf
, "NAN(%s)", tagp
);
30 return strtod (buf
, NULL
);
36 libm_hidden_proto(nanf
)
37 float nanf (const char *tagp
)
39 if (tagp
[0] != '\0') {
40 char buf
[6 + strlen (tagp
)];
41 sprintf (buf
, "NAN(%s)", tagp
);
42 return strtof (buf
, NULL
);
48 #if defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ && !defined __NO_LONG_DOUBLE_MATH
49 libm_hidden_proto(nanl
)
50 long double nanl (const char *tagp
)
52 if (tagp
[0] != '\0') {
53 char buf
[6 + strlen (tagp
)];
54 sprintf (buf
, "NAN(%s)", tagp
);
55 return strtold (buf
, NULL
);