RosettaCodeData/Task/Extreme-floating-point-values/Seed7/extreme-floating-point-values.seed7
2023-07-01 13:44:08 -04:00

26 lines
925 B
Text

$ include "seed7_05.s7i";
include "float.s7i";
const proc: main is func
begin
writeln("positive infinity: " <& Infinity);
writeln("negative infinity: " <& -Infinity);
writeln("negative zero: " <& -0.0);
writeln("not a number: " <& NaN);
# some arithmetic
writeln("+Infinity + 2.0 = " <& Infinity + 2.0);
writeln("+Infinity - 10.1 = " <& Infinity - 10.1);
writeln("+Infinity + -Infinity = " <& Infinity + -Infinity);
writeln("0.0 * +Infinity = " <& 0.0 * Infinity);
writeln("1.0/-0.0 = " <& 1.0 / -0.0);
writeln("NaN + 1.0 = " <& NaN + 1.0);
writeln("NaN + NaN = " <& NaN + NaN);
# some comparisons
writeln("NaN = NaN = " <& NaN = NaN);
writeln("isNaN(NaN) = " <& isNaN(NaN));
writeln("0.0 = -0.0 = " <& 0.0 = -0.0);
writeln("isNegativeZero(-0.0) = " <& isNegativeZero(-0.0));
writeln("isNegativeZero(0.0) = " <& isNegativeZero(0.0));
end func;