2 * Copyright (C) 2002 by Erik Andersen <andersen@uclibc.org>
4 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
7 /***********************************************************************
8 nan, nanf, nanl - return quiet NaN
10 These functions shall return a quiet NaN, if available, with content
11 indicated through tagp.
13 If the implementation does not support quiet NaNs, these functions
16 Calls: strlen(), sprintf(), strtod()
18 ***********************************************************************/
24 double nan (const char *tagp
)
26 if (tagp
[0] != '\0') {
27 char buf
[6 + strlen (tagp
)];
28 sprintf (buf
, "NAN(%s)", tagp
);
29 return strtod (buf
, NULL
);
35 libm_hidden_proto(nanf
)
36 float nanf (const char *tagp
)
38 if (tagp
[0] != '\0') {
39 char buf
[6 + strlen (tagp
)];
40 sprintf (buf
, "NAN(%s)", tagp
);
41 return strtof (buf
, NULL
);
47 #if defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ && !defined __NO_LONG_DOUBLE_MATH
48 libm_hidden_proto(nanl
)
49 long double nanl (const char *tagp
)
51 if (tagp
[0] != '\0') {
52 char buf
[6 + strlen (tagp
)];
53 sprintf (buf
, "NAN(%s)", tagp
);
54 return strtold (buf
, NULL
);