math2_prog.mod 473 B

123456789101112
  1. MODULE Math2Prog;
  2. (* Math additions: hypot/floor/ceil/trunc/log10. Exit 31. *)
  3. IMPORT Math;
  4. VAR ExitCode : INTEGER;
  5. BEGIN
  6. ExitCode := 0;
  7. IF Math.hypot(3.0, 4.0) = 5.0 THEN ExitCode := ExitCode + 1 END;
  8. IF Math.floor(3.7) = 3.0 THEN ExitCode := ExitCode + 2 END;
  9. IF Math.ceil(3.2) = 4.0 THEN ExitCode := ExitCode + 4 END;
  10. IF Math.trunc(-3.7) = -3.0 THEN ExitCode := ExitCode + 8 END;
  11. IF Math.log10(1000.0) = 3.0 THEN ExitCode := ExitCode + 16 END
  12. END Math2Prog.