Task

Write a function which tests if infinity is supported for floating point numbers (this step should be omitted for languages where the language specification already demands the existence of infinity, e.g. by demanding IEEE numbers), and if so, returns positive infinity.   Otherwise, return the largest possible positive floating point number.

For languages with several floating point types, use the type of the literal constant   1.5   as floating point type.



Related task

   Extreme floating point values


DECLARE FUNCTION f! ()
 
ON ERROR GOTO TratoError
PRINT 0!
PRINT 0 / -1.5
PRINT 1.5 / 0
PRINT 0 / 0
PRINT f
END
 
TratoError:
PRINT "Error "; ERR; " on line "; ERL; CHR$(9); " --> ";
SELECT CASE ERR
CASE 6
    PRINT "Overflow"
    RESUME NEXT
CASE 11
    PRINT "Division by zero"
    RESUME NEXT
CASE ELSE
    PRINT "Unexpected error, ending program."
    END
END SELECT
 
FUNCTION f!
    f! = -1.5 / 0
END FUNCTION