Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
std::isfinite(3)	      C++ Standard Libary	      std::isfinite(3)

NAME
       std::isfinite - std::isfinite

Synopsis
	  Defined in header <cmath>
	  bool isfinite( float arg );	     (1) (since	C++11)
						 (constexpr since C++23)
	  bool isfinite( double	arg );	     (2) (since	C++11)
						 (constexpr since C++23)
	  bool isfinite( long double arg );  (3) (since	C++11)
						 (constexpr since C++23)
	  bool isfinite( IntegralType arg ); (4) (since	C++11)
						 (constexpr since C++23)

	  1-3)	Determines  if	the given floating point number	arg has	finite
       value i.e. it is
	  normal, subnormal or zero, but not infinite or NaN.
	  4) A set of overloads	or a function template accepting the arg argu-
       ment of any
	  integral type. Equivalent to (2) (the	argument is cast to double).

Parameters
	  arg -	floating point value

Return value
	  true if arg has finite value,	false otherwise

Examples
       // Run this code

	#include <iostream>
	#include <cmath>
	#include <cfloat>

	int main()
	{
	    std::cout << std::boolalpha
		      << "isfinite(NaN)	= " << std::isfinite(NAN) << '\n'
		      << "isfinite(Inf)	= " << std::isfinite(INFINITY) << '\n'
		      << "isfinite(0.0)	= " << std::isfinite(0.0) << '\n'
		      <<    "isfinite(exp(800))	   =	"    <<	    std::isfi-
       nite(std::exp(800)) << '\n'
		      <<    "isfinite(DBL_MIN/2.0)    =	   "   <<   std::isfi-
       nite(DBL_MIN/2.0) << '\n';
	}

Output:
	isfinite(NaN) =	false
	isfinite(Inf) =	false
	isfinite(0.0) =	true
	isfinite(exp(800)) = false
	isfinite(DBL_MIN/2.0) =	true

See also
	  fpclassify categorizes the given floating-point value
	  (C++11)    (function)
	  isinf	     checks if the given number	is infinite
	  (C++11)    (function)
	  isnan	     checks if the given number	is NaN
	  (C++11)    (function)
	  isnormal   checks if the given number	is normal
	  (C++11)    (function)

http://cppreference.com		  2022.07.31		      std::isfinite(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=std::isfinite&sektion=3&manpath=FreeBSD+Ports+15.0>

home | help