How to resolve the algorithm Infinity step by step in the ERRE programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Infinity step by step in the ERRE programming language

Table of Contents

Problem Statement

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.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Infinity step by step in the ERRE programming language

Source code in the erre programming language

PROGRAM INFINITY

EXCEPTION
    PRINT("INFINITY")
    ESCI%=TRUE
END EXCEPTION

BEGIN
    ESCI%=FALSE
    K=1
    WHILE 2^K>0 DO
       EXIT IF ESCI%
       K+=1
    END WHILE
END PROGRAM

  

You may also check:How to resolve the algorithm Permutations/Derangements step by step in the BBC BASIC programming language
You may also check:How to resolve the algorithm 24 game/Solve step by step in the Tcl programming language
You may also check:How to resolve the algorithm Bitmap step by step in the PL/I programming language
You may also check:How to resolve the algorithm Hello world/Newbie step by step in the Nu programming language
You may also check:How to resolve the algorithm Copy a string step by step in the Slate programming language