How to resolve the algorithm Extreme floating point values step by step in the Raku programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Extreme floating point values step by step in the Raku programming language

Table of Contents

Problem Statement

The IEEE floating point specification defines certain 'extreme' floating point values such as minus zero, -0.0, a value distinct from plus zero; not a number, NaN; and plus and minus infinity. The task is to use expressions involving other 'normal' floating point values in your language to calculate these, (and maybe other), extreme floating point values in your language and assign them to variables. Print the values of these variables if possible; and show some arithmetic with these values and variables. If your language can directly enter these extreme floating point values then show it.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Extreme floating point values step by step in the Raku programming language

Source code in the raku programming language

print qq:to 'END'
positive infinity: {1.8e308}
negative infinity: {-1.8e308}
negative zero: {0e0 * -1}
not a number: {0 * 1e309}
+Inf + 2.0 = {Inf + 2}
+Inf - 10.1 = {Inf - 10.1}
0 * +Inf = {0 * Inf}
+Inf + -Inf = {Inf + -Inf}
+Inf == -Inf = {+Inf == -Inf}
(-Inf+0i)**.5 = {(-Inf+0i)**.5}
NaN + 1.0 = {NaN + 1.0}
NaN + NaN = {NaN + NaN}
NaN == NaN = {NaN == NaN}
0.0 == -0.0 = {0e0 == -0e0}
END


  

You may also check:How to resolve the algorithm Last Friday of each month step by step in the Ada programming language
You may also check:How to resolve the algorithm Sieve of Pritchard step by step in the BASIC programming language
You may also check:How to resolve the algorithm Water collected between towers step by step in the jq programming language
You may also check:How to resolve the algorithm Reverse words in a string step by step in the Common Lisp programming language
You may also check:How to resolve the algorithm 100 doors step by step in the Befunge programming language