1(*
2    Title:      Standard Basis Library: Real Signature
3    Author:     David Matthews
4    Copyright   David Matthews 2000, 2005, 2008, 2016
5
6    This library is free software; you can redistribute it and/or
7    modify it under the terms of the GNU Lesser General Public
8    License version 2.1 as published by the Free Software Foundation.
9    
10    This library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
14    
15    You should have received a copy of the GNU Lesser General Public
16    License along with this library; if not, write to the Free Software
17    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18*)
19
20signature REAL =
21sig
22    type  real
23
24    structure Math : MATH
25        where type real = real
26
27    val radix : int
28    val precision : int
29
30    val maxFinite : real
31    val minPos : real
32    val minNormalPos : real
33
34    val posInf : real
35    val negInf : real
36
37    val + : (real * real) -> real
38    val - : (real * real) -> real
39    val * : (real * real) -> real
40    val / : (real * real) -> real
41    val *+ : real * real * real -> real
42    val *- : real * real * real -> real
43
44    val ~ : real -> real
45    val abs : real -> real
46
47    val min : (real * real) -> real
48    val max : (real * real) -> real
49
50    val sign : real -> int
51    val signBit : real -> bool
52    val sameSign : (real * real) -> bool
53    val copySign : (real * real) -> real
54    val compare : (real * real) -> General.order
55    val compareReal : (real * real) -> IEEEReal.real_order
56
57    val < : (real * real) -> bool
58    val <= : (real * real) -> bool
59    val > : (real * real) -> bool
60    val >= : (real * real) -> bool
61
62    val == : (real * real) -> bool
63    val != : (real * real) -> bool
64
65    val ?= : (real * real) -> bool
66
67    val unordered : (real * real) -> bool
68
69    val isFinite : real -> bool
70    val isNan : real -> bool
71    val isNormal : real -> bool
72    val class : real -> IEEEReal.float_class
73
74    val fmt : StringCvt.realfmt -> real -> string
75    val toString : real -> string
76    val fromString : string -> real option
77
78    val scan : (char, 'a) StringCvt.reader -> (real, 'a) StringCvt.reader
79
80    val toManExp : real -> {man : real, exp : int}
81    val fromManExp : {man : real, exp : int} -> real
82
83    val split : real -> {whole : real, frac : real}
84    val realMod : real -> real
85
86    val rem : (real * real) -> real
87
88    val nextAfter : (real * real) -> real
89
90    val checkFloat : real ->real
91
92    val realFloor : real -> real
93    val realCeil : real -> real
94    val realTrunc : real -> real
95    val realRound : real -> real
96
97    val floor : real -> Int.int
98    val ceil : real -> Int.int
99    val trunc : real -> Int.int
100    val round : real -> Int.int
101
102    val toInt : IEEEReal.rounding_mode -> real -> int
103    val toLargeInt : IEEEReal.rounding_mode -> real -> LargeInt.int
104
105    val fromInt : int -> real
106    val fromLargeInt : LargeInt.int -> real
107
108    val toLarge : real -> LargeReal.real
109    val fromLarge : IEEEReal.rounding_mode -> LargeReal.real -> real
110
111    val toDecimal : real -> IEEEReal.decimal_approx
112    val fromDecimal : IEEEReal.decimal_approx -> real option
113end;
114