File: RealConv.md

package info (click to toggle)
mocka 9905-2
  • links: PTS
  • area: non-free
  • in suites: potato, sarge, woody
  • size: 5,436 kB
  • ctags: 160
  • sloc: asm: 23,203; makefile: 124; sh: 102; ansic: 23
file content (46 lines) | stat: -rw-r--r-- 1,998 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
(******************************************************************************)
(* Copyright (c) 1988 by GMD Karlruhe, Germany				      *)
(* Gesellschaft fuer Mathematik und Datenverarbeitung			      *)
(* (German National Research Center for Computer Science)		      *)
(* Forschungsstelle fuer Programmstrukturen an Universitaet Karlsruhe	      *)
(* All rights reserved.							      *)
(* Don't modify this file under any circumstances			      *)
(******************************************************************************)

DEFINITION MODULE RealConv;

  (* (w) 1990 CvR *)

  (* This procedures only work if maschine use IEEE Standard for REALs *)
  (* HH 03/93 *)
  
  PROCEDURE IsLongRealInfinityOrNaN (x: LONGREAL) : BOOLEAN;
  PROCEDURE IsRealInfinityOrNaN     (x: REAL)	  : BOOLEAN;
  PROCEDURE IsLongRealInfinity	    (x: LONGREAL) : BOOLEAN;
  PROCEDURE IsRealInfinity	    (x: REAL)	  : BOOLEAN;


  PROCEDURE Str2Real(s: ARRAY OF CHAR; VAR done: BOOLEAN): REAL;
  (* Converts the string 's' to real 'x'.			*)
  (* s has to be of the form:					*)
  (* real   = num ['.' {digit}] ['E' num].			*)
  (* num    = ['+'|'-'] digit {digit}.				*)

  PROCEDURE Str2LongReal(s: ARRAY OF CHAR; VAR done: BOOLEAN): LONGREAL;
  (* Converts the string 's' to real 'x'.			*)
  (* s has to be of the form:					*)
  (* real   = num ['.' {digit}] ['E' num].			*)
  (* num    = ['+'|'-'] digit {digit}.				*)

  PROCEDURE Real2Str(x : REAL; n : CARDINAL; k : INTEGER; VAR s: ARRAY OF CHAR; VAR done: BOOLEAN);
  (* Convert real 'x' into external representation.	*)
  (* IF k > 0 use k decimal places.			*)
  (* IF k = 0 write 'x' as integer.			*)
  (* IF k < 0 use scientific notation.			*)

  PROCEDURE LongReal2Str(x : LONGREAL; n : CARDINAL; k : INTEGER; VAR s: ARRAY OF CHAR; VAR done: BOOLEAN);
  (* Convert long real 'x' into external representation.*)
  (* IF k > 0 use k decimal places.			*)
  (* IF k = 0 write 'x' as integer.			*)
  (* IF k < 0 use scientific notation.			*)
END RealConv.