{"id":24143,"date":"2021-10-14T08:32:47","date_gmt":"2021-10-14T03:02:47","guid":{"rendered":"https:\/\/python-programs.com\/?p=24143"},"modified":"2021-11-05T20:54:05","modified_gmt":"2021-11-05T15:24:05","slug":"python-program-for-isfinite-function","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-for-isfinite-function\/","title":{"rendered":"Python Program for isfinite() Function"},"content":{"rendered":"

In the previous article, we have discussed Python Program for fsum() Function<\/a>
\nisfinite() Function in Python:<\/strong><\/p>\n

The math.isfinite() method determines whether or not a number is finite.<\/p>\n

If the specified number is a finite number, this method returns true; otherwise, it returns False.<\/p>\n

Syntax:<\/strong><\/p>\n

math.isfinite(value)<\/pre>\n

Parameters:<\/strong><\/p>\n

Value:<\/strong> This is required. The value to be checked. A number (float\/integer\/infinite\/NaN\/finite) must be specified.<\/p>\n

Return Value: <\/strong>It returns a boolean value. Returns True if x is finite and False if x is infinity or NaN.<\/p>\n

Examples:<\/strong><\/p>\n

Example1:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given Number = 20\r\nGiven number = -100\r\nGiven Number = math.pi\r\nGiven value = NaN\r\nGiven value = inf<\/pre>\n

Output:<\/strong><\/p>\n

Checking if the above given number 20 is finite or not : True\r\nTrue\r\nTrue\r\nFalse\r\nFalse<\/pre>\n

Example2:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given Number = 10000\r\nGiven value = -math.inf\r\nGiven value = nan<\/pre>\n

Output:<\/strong><\/p>\n

Checking if the above given number 10000 is finite or not : True\r\nFalse\r\nFalse<\/pre>\n

Program for isfinite() Function in Python<\/h2>\n