Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

nanf(3) [freebsd man page]

NAN(3)							   BSD Library Functions Manual 						    NAN(3)

NAME
nan, nanf, nanl -- quiet NaNs LIBRARY
Math Library (libm, -lm) SYNOPSIS
#include <math.h> double nan(const char *s); float nanf(const char *s); long double nanl(const char *s); DESCRIPTION
The NAN macro expands to a quiet NaN (Not A Number). Similarly, each of the nan(), nanf(), and nanl() functions generate a quiet NaN value without raising an invalid exception. The argument s should point to either an empty string or a hexadecimal representation of a non-nega- tive integer (e.g., "0x1234".) In the latter case, the integer is encoded in some free bits in the representation of the NaN, which some- times store machine-specific information about why a particular NaN was generated. There are 22 such bits available for float variables, 51 bits for double variables, and at least 51 bits for a long double. If s is improperly formatted or represents an integer that is too large, then the particular encoding of the quiet NaN that is returned is indeterminate. COMPATIBILITY
Calling these functions with a non-empty string isn't portable. Another operating system may translate the string into a different NaN encoding, and furthermore, the meaning of a given NaN encoding varies across machine architectures. If you understood the innards of a par- ticular platform well enough to know what string to use, then you would have no need for these functions anyway, so don't use them. Use the NAN macro instead. SEE ALSO
fenv(3), ieee(3), isnan(3), math(3), strtod(3) STANDARDS
The nan(), nanf(), and nanl() functions and the NAN macro conform to ISO/IEC 9899:1999 (``ISO C99''). BSD
December 16, 2007 BSD

Check Out this Related Man Page

nan(3M) 						  Mathematical Library Functions						   nan(3M)

NAME
nan, nanf, nanl - return quiet NaN SYNOPSIS
cc [ flag... ] file... -lm [ library... ] #include <math.h> double nan(const char *tagp); float nanf(const char *tagp); long double nanl(const char *tagp); DESCRIPTION
The function call nan("n-char-sequence") is equivalent to: strtod("NAN(n-char-sequence)", (char **) NULL); The function call nan(" ") is equivalent to: strtod("NAN()", (char **) NULL) If tagp does not point to an n-char sequence or an empty string, the function call is equivalent to: strtod("NAN", (char **) NULL) Function calls to nanf() and nanl() are equivalent to the corresponding function calls to strtof() and strtold(). See strtod(3C). RETURN VALUES
These functions return a quiet NaN. ERRORS
No errors are defined. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
math.h(3HEAD), strtod(3C), attributes(5), standards(5) SunOS 5.10 1 Sep 2002 nan(3M)
Man Page

4 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to use grep to check NAN value and nonexistense element in file

Hi, I have a file which computes fields number and some column produced "nan" I would like to convert the "nan" value to 0 basically. q=`echo $i $j |awk '{printf("%f",($2/($1+$2)))}' The above is the command which I use for computation. However, I would like to check if $1 and $2 is 0, it... (1 Reply)
Discussion started by: ahjiefreak
1 Replies

2. UNIX for Dummies Questions & Answers

paste two tables of different sizes and fill blanks with NaN

Hello, I am pasting two tables of 6x4 and 4x4 together to get a 10x8 output. I want to fill the blank values with a NaN (Not a Number). How can I do this? Thanks, Guss (3 Replies)
Discussion started by: Gussifinknottle
3 Replies

3. Shell Programming and Scripting

First character of variable

I am trying to detect 'nan' (not a number) string in my large txt file filled with lots of numbers. A file may have no or many 'nan'. It should be simple but getting errors. Any help appreciated. Here is what I have: #!/bin/tcsh set case1 = test0.txt set chk = `grep 'nan' $case1` set op =... (4 Replies)
Discussion started by: Anu108
4 Replies

4. Programming

Strange value of the double type variable: -nan(0x8000000000000)

I am confused by the value of "currdisk->currangle" after adding operation. Initially the value of "currdisk->currangle" is 0.77500000000000013, but after adding operation, it's changed to "-nan(0x8000000000000)", Can anyone explain ? Thanks! The following is the occasion of gdb debugging. 3338 ... (8 Replies)
Discussion started by: 915086731
8 Replies