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

In the previous article, we have discussed Python Program for How To Find Cube Root<\/a>
\nisinf() Function in Python:<\/strong><\/p>\n

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

If the specified number is positive or negative infinity, this method returns true; otherwise, it returns False.<\/p>\n

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

math.isinf(x)<\/pre>\n

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

x: <\/strong>This is required. It is a number to check.<\/p>\n

Return Value: <\/strong>It returns a boolean value. If x is positive or negative infinity, this statement is true. Otherwise, false.<\/p>\n

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

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

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

Given value = 1000\r\nGiven value = -100\r\nGiven value =  math.pi\r\nGiven value = nan\r\nGiven value = inf\r\nGiven value = -inf<\/pre>\n

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

False\r\nFalse\r\nFalse\r\nFalse\r\nTrue\r\nTrue<\/pre>\n

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

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

Given value = -70000\r\nGiven value = NaN<\/pre>\n

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

False\r\nFalse<\/pre>\n

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