/[eiffelstudio]/FreeELKS/trunk/library/kernel/basic_routines.e
ViewVC logotype

Contents of /FreeELKS/trunk/library/kernel/basic_routines.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 91424 - (show annotations)
Tue Oct 26 18:39:32 2004 UTC (15 years, 2 months ago) by manus_eiffel
File size: 2516 byte(s)
Initial revision

1 indexing
2
3 description: "Some useful facilities on objects of basic types"
4
5 status: "See notice at end of class"
6 date: "$Date$"
7 revision: "$Revision$"
8
9 class
10 BASIC_ROUTINES
11
12 feature -- Conversion
13
14 charconv (i: INTEGER): CHARACTER is
15 -- Character corresponding to ascii code `i'
16 external
17 "C [macro %"eif_misc.h%"]"
18 alias
19 "chconv"
20 end
21
22 feature -- Basic operations
23
24 abs (n: INTEGER): INTEGER is
25 -- Absolute value of `n'
26 do
27 if n < 0 then
28 Result := -n
29 else
30 Result := n
31 end
32 ensure
33 non_negative_result: Result >= 0
34 end
35
36 sign (n: INTEGER): INTEGER is
37 -- Sign of `n':
38 -- -1 if `n' < 0
39 -- 0 if `n' = 0
40 -- +1 if `n' > 0
41 do
42 if n < 0 then
43 Result := -1
44 elseif n > 0 then
45 Result := +1
46 end
47 ensure
48 correct_negative: (n < 0) = (Result = -1)
49 correct_zero: (n = 0) = (Result = 0)
50 correct_positive: (n > 0) = (Result = +1)
51 end
52
53 rsign (r: REAL): INTEGER is
54 -- Sign of `r':
55 -- -1 if `r' < 0
56 -- 0 if `r' = 0
57 -- +1 if `r' > 0
58 do
59 if r < 0 then
60 Result := -1
61 elseif r > 0 then
62 Result := +1
63 end
64 ensure
65 correct_negative: (r < 0) = (Result = -1)
66 correct_zero: (r = 0) = (Result = 0)
67 correct_positive: (r > 0) = (Result = +1)
68 end
69
70 bottom_int_div (n1, n2: INTEGER): INTEGER is
71 -- Greatest lower bound of the integer division of `n1' by `n2'
72 external
73 "C | %"eif_misc.h%""
74 alias
75 "bointdiv"
76 end
77
78 up_int_div (n1, n2: INTEGER): INTEGER is
79 -- Least upper bound of the integer division
80 -- of `n1' by `n2'
81 external
82 "C | %"eif_misc.h%""
83 alias
84 "upintdiv"
85 end
86
87 indexing
88
89 library: "[
90 EiffelBase: Library of reusable components for Eiffel.
91 ]"
92
93 status: "[
94 Copyright 1986-2001 Interactive Software Engineering (ISE).
95 For ISE customers the original versions are an ISE product
96 covered by the ISE Eiffel license and support agreements.
97 ]"
98
99 license: "[
100 EiffelBase may now be used by anyone as FREE SOFTWARE to
101 develop any product, public-domain or commercial, without
102 payment to ISE, under the terms of the ISE Free Eiffel Library
103 License (IFELL) at http://eiffel.com/products/base/license.html.
104 ]"
105
106 source: "[
107 Interactive Software Engineering Inc.
108 ISE Building
109 360 Storke Road, Goleta, CA 93117 USA
110 Telephone 805-685-1006, Fax 805-685-6869
111 Electronic mail <info@eiffel.com>
112 Customer support http://support.eiffel.com
113 ]"
114
115 info: "[
116 For latest info see award-winning pages: http://eiffel.com
117 ]"
118
119 end -- class BASIC_ROUTINES
120
121
122

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.23