It's possible to represent values that aren't real numbers, such as 0 / 0, in the IEEE floating-point format. There are two kinds of NaNs, quiet NaNs, or QNaNs, and signaling NaNs, or SNaNs. Method 1 : Using compare (“==”) operator. NaN means - Not a Number. The NaN values are used to identify undefined or non-representable values for floating-point elements, such as the square root of negative numbers or the result of 0/0. A NaN is represented by an exponent of all ones and a non-zero significand. Macro constant that expands to an expression of type float that represents a NaN if the implementation supports quiet NaNs (otherwise, it is not defined). Returns the special value "quiet not-a-number", as represented by the floating-point type T.Only meaningful if std:: numeric_limits < T >:: has_quiet_NaN == true.In IEEE 754, the most common binary representation of floating-point numbers, any value with all bits of the exponent set and at least one bit of the fraction set represents a NaN. A NaN is generated when the result of a floating-point operation can't be represented in IEEE-754 floating-point format for the specified type. This field is a static member of the structure. The argument x can be any floating-point expression; the macros detect the type of the argument and work for float and double. Float is a datatype which is used to represent the floating point numbers. The NaN value can also be obtained from a constant field of the float or double structures. A value of this kind is called a NaN. NaN - Not a Number. EDIT: Since you don't want to use (or cannot use) , you could use other properties of nan and inf to classify your numers: nan compares false to all numbers, including to itself; inf is greater than FLT_MAX; But if result is false, then “nan” is returned, i.e the number is complex. When compiled as C++, the isnan macro is not defined, and an isnan template function is defined Sama seperti bahasa pemrograman pada umumnya, kita menggunakan tanda titik sebagai pemisah angka bulat dan pecahan, bukan tanda koma seperti yang kita … Represents a value that is not a number (NaN). In this method we check if a number is complex by comparing it with itself. It has 6 decimal digits of precision. It cannot be used for comparison purposes, as two NaN values could logically be different, so equality tests will always return false. Output: 1.41421 -nan How to check for NaN ? Returns a quiet NaN (Not-A-Number) value of type float. The argument can be used by library implementations to distinguish different NaN values in a implementation-specific manner. Pengertian Tipe Data Float Bahasa C. Tipe data float digunakan untuk menampung angka pecahan seperti 3.14, 62.22 atau -0.01234. If you try this example in javacript : [code]var x = 100 / "Apple"; result will be- // x will be NaN (Not a Number) [/code]Hope it will help you. This field is constant. It is a 32-bit IEEE 754 single precision floating point number ( 1-bit for the sign, 8-bit for exponent, 23*-bit for the value. For information about how a NaN is represented for output, see printf. Float. The NaN values are used to identify undefined or non-representable values for floating-point elements, such as the square root of negative numbers or the result of 0/0. If the result is true, then the number is not complex i.e., real. In C, this is implemented as a macro that returns an int value. In computing, NaN, standing for Not a Number, is a member of a numeric data type that can be interpreted as a value that is undefined or unrepresentable, especially in floating-point arithmetic.Systematic use of NaNs was introduced by the IEEE 754 floating-point standard in 1985, along with the representation of other non-finite quantities such as infinities. See also nan Generate quiet NaN (function ) nanf Generate quiet NaN (float) (function ) isnan Is Not-A-Number (macro/function )